poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] pkl-asm.c: Improve readability by reducing Jemarchism


From: Mohammad-Reza Nabipoor
Subject: [PATCH] pkl-asm.c: Improve readability by reducing Jemarchism
Date: Fri, 14 Jan 2022 02:10:58 +0330

2022-01-14  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>

        * libpoke/pkl-asm.c (pkl_asm_insn_peek): Replace
        `!!((size - 1) & ~0x1f)` non-sense with `size > 32`.
        (pkl_asm_insn_peekd): Likewise.
        (pkl_asm_insn_print): Likewise.
        (pkl_asm_insn_poke): Likewise.
        (pkl_asm_insn_poked): Likewise.
        (pkl_asm_insn_binop): Likewise.
        (pkl_asm_insn_cmp): Likewise.
        (pkl_asm_insn_swapgt): Likewise.
        (pkl_asm_insn_bz): Likewise.
        (pkl_asm_insn_bnz): Likewise.
---
 ChangeLog         | 14 ++++++++++++++
 libpoke/pkl-asm.c | 20 ++++++++++----------
 2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0ad25e9a..e138782b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2022-01-14  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
+
+       * libpoke/pkl-asm.c (pkl_asm_insn_peek): Replace
+       `!!((size - 1) & ~0x1f)` non-sense with `size > 32`.
+       (pkl_asm_insn_peekd): Likewise.
+       (pkl_asm_insn_print): Likewise.
+       (pkl_asm_insn_poke): Likewise.
+       (pkl_asm_insn_poked): Likewise.
+       (pkl_asm_insn_binop): Likewise.
+       (pkl_asm_insn_cmp): Likewise.
+       (pkl_asm_insn_swapgt): Likewise.
+       (pkl_asm_insn_bz): Likewise.
+       (pkl_asm_insn_bnz): Likewise.
+
 2022-01-14  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
 
        * libpoke/ios-dev.h (struct ios_dev_if): Move comments to
diff --git a/libpoke/pkl-asm.c b/libpoke/pkl-asm.c
index 9e614f20..0e622405 100644
--- a/libpoke/pkl-asm.c
+++ b/libpoke/pkl-asm.c
@@ -389,7 +389,7 @@ pkl_asm_insn_peek (pkl_asm pasm, pkl_ast_node type,
          {PKL_INSN_PEEKLU, PKL_INSN_PEEKL}
         };
 
-      int tl = !!((size - 1) & ~0x1f);
+      int tl = size > 32;
 
       if (sign)
         pkl_asm_insn (pasm, peek_table[tl][sign],
@@ -426,7 +426,7 @@ pkl_asm_insn_peekd (pkl_asm pasm, pkl_ast_node type)
          {PKL_INSN_PEEKDLU, PKL_INSN_PEEKDL}
         };
 
-      int tl = !!((size - 1) & ~0x1f);
+      int tl = size > 32;
 
       pkl_asm_insn (pasm, peekd_table[tl][sign],
                     (unsigned int) size);
@@ -510,7 +510,7 @@ pkl_asm_insn_print (pkl_asm pasm, pkl_ast_node type)
          {PKL_INSN_PRINTLU, PKL_INSN_PRINTL}
         };
 
-      int tl = !!((size - 1) & ~0x1f);
+      int tl = size > 32;
 
       pkl_asm_insn (pasm, print_table[tl][signed_p],
                     (unsigned int) size);
@@ -542,7 +542,7 @@ pkl_asm_insn_poke (pkl_asm pasm, pkl_ast_node type,
          {PKL_INSN_POKELU, PKL_INSN_POKEL}
         };
 
-      int tl = !!((size - 1) & ~0x1f);
+      int tl = size > 32;
 
       if (signed_p)
         pkl_asm_insn (pasm, poke_table[tl][signed_p],
@@ -580,7 +580,7 @@ pkl_asm_insn_poked (pkl_asm pasm, pkl_ast_node type)
          {PKL_INSN_POKEDLU, PKL_INSN_POKEDL}
         };
 
-      int tl = !!((size - 1) & ~0x1f);
+      int tl = size > 32;
 
       pkl_asm_insn (pasm, poked_table[tl][signed_p],
                     (unsigned int) size);
@@ -682,7 +682,7 @@ pkl_asm_insn_binop (pkl_asm pasm,
 
       uint64_t size = PKL_AST_TYPE_I_SIZE (type);
       int signed_p = PKL_AST_TYPE_I_SIGNED_P (type);
-      int tl = !!((size - 1) & ~0x1f);
+      int tl = size > 32;
 
       switch (insn)
         {
@@ -880,7 +880,7 @@ pkl_asm_insn_cmp (pkl_asm pasm,
 
       uint64_t size = PKL_AST_TYPE_I_SIZE (type);
       int signed_p = PKL_AST_TYPE_I_SIGNED_P (type);
-      int tl = !!((size - 1) & ~0x1f);
+      int tl = size > 32;
 
       switch (insn)
         {
@@ -1107,7 +1107,7 @@ pkl_asm_insn_swapgt (pkl_asm pasm, pkl_ast_node type)
   size_t size = PKL_AST_TYPE_I_SIZE (type);
   int signed_p = PKL_AST_TYPE_I_SIGNED_P (type);
 
-  int tl = !!((size - 1) & ~0x1f);
+  int tl = size > 32;
   pkl_asm_insn (pasm, swapgt_table[tl][signed_p]);
 }
 
@@ -1128,7 +1128,7 @@ pkl_asm_insn_bz (pkl_asm pasm,
   size_t size = PKL_AST_TYPE_I_SIZE (type);
   int signed_p = PKL_AST_TYPE_I_SIGNED_P (type);
 
-  int tl = !!((size - 1) & ~0x1f);
+  int tl = size > 32;
 
   pkl_asm_insn (pasm, bz_table[tl][signed_p], label);
 }
@@ -1150,7 +1150,7 @@ pkl_asm_insn_bnz (pkl_asm pasm,
   size_t size = PKL_AST_TYPE_I_SIZE (type);
   int signed_p = PKL_AST_TYPE_I_SIGNED_P (type);
 
-  int tl = !!((size - 1) & ~0x1f);
+  int tl = size > 32;
 
   pkl_asm_insn (pasm, bnz_table[tl][signed_p], label);
 }
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]