(* Some bugs in Word32 on 64-bit and a bug in arithmetic right shift
   with a constant shift value. *)

fun check a b = if a = b then () else raise Fail "Bad";


check(Word32.toIntX 0wx0) 0;
check(Word32.toIntX 0wx1) 1;
check(Word32.toIntX 0wx7FFFFFFF) 2147483647;
check(Word32.toIntX 0wx80000000) ~2147483648;
check(Word32.toIntX 0wx80000001) ~2147483647;
check(Word32.toIntX 0wxFFFFFFFE) ~2;
check(Word32.toIntX 0wxFFFFFFFF) ~1;

check(Word32.toLargeX 0wx0) 0wx0;
check(Word32.toLargeX 0wx1) 0wx1;
check(Word32.toLargeX 0wx7FFFFFFF) 0wx7FFFFFFF;


check (let val r = ref 0w4 in Word.~>>(!r, 0w1) end) 0w2;

(* Checks that fromLargeInt returns the same result as fromInt *)

check(Word32.fromLargeInt ~1 = 0wxFFFFFFFF);
check(Word32.fromLargeInt (IntInf.pow (2, 32)) = 0wx0);

(* Some bugs in Word32 on 64-bit and a bug in arithmetic right shift
   with a constant shift value. *)

fun check a b = if a = b then () else raise Fail "Bad";


check(Word32.toIntX 0wx0) 0;
check(Word32.toIntX 0wx1) 1;
check(Word32.toIntX 0wx7FFFFFFF) 2147483647;
check(Word32.toIntX 0wx80000000) ~2147483648;
check(Word32.toIntX 0wx80000001) ~2147483647;
check(Word32.toIntX 0wxFFFFFFFE) ~2;
check(Word32.toIntX 0wxFFFFFFFF) ~1;

check(Word32.toLargeX 0wx0) 0wx0;
check(Word32.toLargeX 0wx1) 0wx1;
check(Word32.toLargeX 0wx7FFFFFFF) 0wx7FFFFFFF;


check (let val r = ref 0w4 in Word.~>>(!r, 0w1) end) 0w2;

(* Checks that fromLargeInt returns the same result as fromInt *)

check(Word32.fromLargeInt ~1) 0wxFFFFFFFF;
check(Word32.fromLargeInt (IntInf.pow (2, 32))) 0wx0;

Fix the regression test. The wrong version was committed.
Fix the regression test.  The wrong version was committed.

git-svn-id: 98787b36aaefbae4b30fa755be920954cd25e1e4@1843 ae7d391e-3f74-4a2b-a0db-a8776840fd2a
