lyb OPTIMIZE for a fixed length plugin types

The length number is not printed/parsed.
diff --git a/src/printer_lyb.c b/src/printer_lyb.c
index 4023646..dade5de 100644
--- a/src/printer_lyb.c
+++ b/src/printer_lyb.c
@@ -704,30 +704,54 @@
 static LY_ERR
 lyb_print_term(struct lyd_node_term *term, struct ly_out *out, struct lylyb_ctx *lybctx)
 {
-    LY_ERR ret;
+    LY_ERR ret = LY_SUCCESS;
     ly_bool dynamic = 0;
     void *value;
     size_t value_len = 0;
+    int32_t lyb_data_len;
+    lyplg_type_print_clb print;
 
     assert(term->value.realtype && term->value.realtype->plugin && term->value.realtype->plugin->print &&
             term->schema);
 
-    value = (void *)term->value.realtype->plugin->print(term->schema->module->ctx,
-            &term->value, LY_VALUE_LYB, NULL, &dynamic, &value_len);
-    LY_CHECK_RET(!value, LY_EINT);
+    /* Get length of LYB data to print. */
+    lyb_data_len = term->value.realtype->plugin->lyb_data_len;
 
-    if (value_len > UINT32_MAX) {
-        LOGERR(lybctx->ctx, LY_EINT, "The maximum length of the LYB data "
-                "from a term node must not exceed %lu.", UINT32_MAX);
-        return LY_EINT;
+    /* Get value and also print its length only if size is not fixed. */
+    print = term->value.realtype->plugin->print;
+    if (lyb_data_len < 0) {
+        /* Variable-length data. */
+
+        /* Get value and its length from plugin. */
+        value = (void *)print(term->schema->module->ctx, &term->value,
+                LY_VALUE_LYB, NULL, &dynamic, &value_len);
+        LY_CHECK_GOTO(ret, cleanup);
+
+        if (value_len > UINT32_MAX) {
+            LOGERR(lybctx->ctx, LY_EINT, "The maximum length of the LYB data "
+                    "from a term node must not exceed %lu.", UINT32_MAX);
+            ret = LY_EINT;
+            goto cleanup;
+        }
+
+        /* Print the length of the data as 32-bit unsigned integer. */
+        ret = lyb_write_number(value_len, sizeof(uint32_t), out, lybctx);
+        LY_CHECK_GOTO(ret, cleanup);
+    } else {
+        /* Fixed-length data. */
+
+        /* Get value from plugin. */
+        value = (void *)print(term->schema->module->ctx, &term->value,
+                LY_VALUE_LYB, NULL, &dynamic, NULL);
+        LY_CHECK_GOTO(ret, cleanup);
+
+        /* Copy the length from the compiled node. */
+        value_len = lyb_data_len;
     }
 
-    /* Print the length of the data as 32-bit unsigned integer. */
-    ret = lyb_write_number(value_len, sizeof(uint32_t), out, lybctx);
-    LY_CHECK_GOTO(ret, cleanup);
-
+    /* Print value. */
     if (value_len > 0) {
-        /* Print the data simply as it is. */
+        /* Print the value simply as it is. */
         ret = lyb_write(out, value, value_len, lybctx);
         LY_CHECK_GOTO(ret, cleanup);
     }