Corollary xor_interval:
  forall a b, 0 <= unsigned (xor a b) < two_p (Z.max (size a) (size b)).Definition wordsize := 32%nat.Remark wordsize_not_zero: wordsize <> 0%nat.Module Int := Make(Wordsize_32).Notation int := Int.int.Remark int_wordsize_divides_modulus:
  Z.divide (Z.of_nat Int.wordsize) Int.modulus.Definition wordsize := 8%nat.Remark wordsize_not_zero: wordsize <> 0%nat.Module Byte := Make(Wordsize_8).Notation byte := Byte.int.Definition wordsize := 64%nat.Remark wordsize_not_zero: wordsize <> 0%nat.(** Shifts with amount given as a 32-bit integer *)

Definition iwordsize': Int.int := Int.repr zwordsize.Definition shl' (x: int) (y: Int.int): int :=
  repr (Z.shiftl (unsigned x) (Int.unsigned y)).Definition shru' (x: int) (y: Int.int): int :=
  repr (Z.shiftr (unsigned x) (Int.unsigned y)).Definition shr' (x: int) (y: Int.int): int :=
  repr (Z.shiftr (signed x) (Int.unsigned y)).Definition rol' (x: int) (y: Int.int): int :=
  rol x (repr (Int.unsigned y)).Definition shrx' (x: int) (y: Int.int): int :=
  divs x (shl' one y).Definition shr_carry' (x: int) (y: Int.int): int :=
  if lt x zero && negb (eq (and x (sub (shl' one y) one)) zero)
  then one else zero.

Lemma bits_shl': forall x y i, 0 <= i < zwordsize -> testbit (shl' x y) i = if zlt i (Int.unsigned y) then false else testbit x (i - Int.unsigned y).