[uim-commit] r1227 - branches/r5rs/sigscheme

yamaken at freedesktop.org yamaken at freedesktop.org
Thu Aug 18 11:35:05 PDT 2005


Author: yamaken
Date: 2005-08-18 11:35:02 -0700 (Thu, 18 Aug 2005)
New Revision: 1227

Modified:
   branches/r5rs/sigscheme/operations.c
Log:
* sigscheme/operations.c
  - (ScmOp_oddp, ScmOp_evenp): Simplified. Revert if the logic or
    coding style is not preferable.

    This is a coding style suggestion about using the conditional
    expression ?:


Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c	2005-08-18 17:09:29 UTC (rev 1226)
+++ branches/r5rs/sigscheme/operations.c	2005-08-18 18:35:02 UTC (rev 1227)
@@ -533,25 +533,18 @@
 
 ScmObj ScmOp_oddp(ScmObj scm_num)
 {
-    if (EQ(ScmOp_numberp(scm_num), SCM_FALSE))
+    if (SCM_FALSEP(ScmOp_numberp(scm_num)))
         SigScm_ErrorObj("odd? : number required but got ", scm_num);
 
-    if (SCM_INT_VALUE(scm_num) % 2 == 1
-	|| SCM_INT_VALUE(scm_num) % 2 == -1)
-        return SCM_TRUE;
-    else
-        return SCM_FALSE;
+    return (SCM_INT_VALUE(scm_num) & 0x1) ? SCM_TRUE : SCM_FALSE;
 }
 
 ScmObj ScmOp_evenp(ScmObj scm_num)
 {
-    if (EQ(ScmOp_numberp(scm_num), SCM_FALSE))
+    if (SCM_FALSEP(ScmOp_numberp(scm_num)))
         SigScm_ErrorObj("even? : number required but got ", scm_num);
 
-    if (SCM_INT_VALUE(scm_num) % 2 == 0)
-        return SCM_TRUE;
-    else
-        return SCM_FALSE;
+    return (SCM_INT_VALUE(scm_num) & 0x1) ? SCM_FALSE : SCM_TRUE;
 }
 
 ScmObj ScmOp_max(ScmObj args, ScmObj env )



More information about the uim-commit mailing list