]> git.mdlowis.com Git - projs/onward.git/commitdiff
Fixed alignment algorithm in create word
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 29 Jan 2015 17:47:00 +0000 (12:47 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 29 Jan 2015 17:47:00 +0000 (12:47 -0500)
source/onward.c

index d436317dbbca3178f873cce17fd7806d5d8e42fd..5f1a2351ae3f891186bd9c369166b957d9852d1c 100755 (executable)
@@ -212,9 +212,7 @@ defcode("create", create, &exec, 0u) {
     char* name = (char*)onward_aspop();
     /* Copy the name to a more permanent location */
     size_t str_size = strlen(name) + 1;
-    size_t new_size = (str_size % sizeof(value_t))
-                        ? ((str_size + (sizeof(value_t) - 1)) & ~sizeof(value_t))
-                        : str_size;
+    size_t new_size = str_size + ((sizeof(value_t) - (str_size % sizeof(value_t))) % sizeof(value_t));
     name = memcpy((void*)here, name, str_size);
     here += new_size;
     /* Start populating the word definition */