]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_cryptkit/lib/giantIntegers.c
Security-57740.1.18.tar.gz
[apple/security.git] / OSX / libsecurity_cryptkit / lib / giantIntegers.c
index e7872b58801ae7f9cc398faceb27c88763520a20..734ab60e17aceb181895a1a3d07221cf913b8201 100644 (file)
@@ -493,7 +493,7 @@ giant copyGiant(giant x)
 
 unsigned bitlen(giant n) {
     unsigned   b = GIANT_BITS_PER_DIGIT;
-    giantDigit         c = 1 << (GIANT_BITS_PER_DIGIT - 1);
+    giantDigit         c = ((giantDigit)1) << (GIANT_BITS_PER_DIGIT - 1);
     giantDigit         w;
 
     if (isZero(n)) {
@@ -512,9 +512,9 @@ unsigned bitlen(giant n) {
 
 int bitval(giant n, int pos) {
     int i = abs(pos) >> GIANT_LOG2_BITS_PER_DIGIT;
-    giantDigit c = 1 << (pos & (GIANT_BITS_PER_DIGIT - 1));
+    giantDigit c = ((giantDigit)1) << (pos & (GIANT_BITS_PER_DIGIT - 1));
 
-    return((n->n[i]) & c);
+    return ((0!=((n->n[i]) & c))?1:0);
 }
 
 int gsign(giant g)