integer BUGFIX storing numbers on big-endian

Fixes #2392
diff --git a/src/plugins_types/integer.c b/src/plugins_types/integer.c
index c1fdad8..a8567d8 100644
--- a/src/plugins_types/integer.c
+++ b/src/plugins_types/integer.c
@@ -75,7 +75,24 @@
     /* store everything */
     ret = lydict_insert_zc(ctx, str, &storage->canonical);
     LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
-    storage->int64 = num;
+
+    /* matters for big-endian */
+    switch (type->basetype) {
+    case LY_TYPE_INT8:
+        storage->int8 = num;
+        break;
+    case LY_TYPE_INT16:
+        storage->int16 = num;
+        break;
+    case LY_TYPE_INT32:
+        storage->int32 = num;
+        break;
+    case LY_TYPE_INT64:
+        storage->int64 = num;
+        break;
+    default:
+        break;
+    }
     storage->realtype = type;
 
 cleanup:
@@ -131,7 +148,24 @@
     /* store everything */
     ret = lydict_insert_zc(ctx, str, &storage->canonical);
     LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
-    storage->int64 = num;
+
+    /* matters for big-endian */
+    switch (type->basetype) {
+    case LY_TYPE_UINT8:
+        storage->uint8 = num;
+        break;
+    case LY_TYPE_UINT16:
+        storage->uint16 = num;
+        break;
+    case LY_TYPE_UINT32:
+        storage->uint32 = num;
+        break;
+    case LY_TYPE_UINT64:
+        storage->uint64 = num;
+        break;
+    default:
+        break;
+    }
     storage->realtype = type;
 
 cleanup: