]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_cryptkit/lib/giantIntegers.c
Security-58286.260.20.tar.gz
[apple/security.git] / OSX / libsecurity_cryptkit / lib / giantIntegers.c
index e7872b58801ae7f9cc398faceb27c88763520a20..d5a1953736674dc2fba04992d8efa935f5b57fb1 100644 (file)
@@ -493,7 +493,7 @@ giant copyGiant(giant x)
 
 unsigned bitlen(giant n) {
     unsigned   b = GIANT_BITS_PER_DIGIT;
 
 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)) {
     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;
 
 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)
 }
 
 int gsign(giant g)
@@ -1047,7 +1047,6 @@ void gshiftleft(int bits, giant g) {
     if(!size) return;
     if((size+digits) > (int)g->capacity) {
         CKRaise("gshiftleft overflow");
     if(!size) return;
     if((size+digits) > (int)g->capacity) {
         CKRaise("gshiftleft overflow");
-        return;
     }
     k = size - 1 + digits;     // (MSD of result + 1)
     carry = 0;
     }
     k = size - 1 + digits;     // (MSD of result + 1)
     carry = 0;