(* Definition Vubyte (c: Byte.int) : val := Vint (Int.repr (Byte.unsigned c)).  Lemma Znth_map_Vubyte: forall (i : Z) (l : list byte), 0 <= i < Zlength l -> Znth i (map Vubyte l)  = Vubyte (Znth i l). Locate Znth_map_Vubyte. Hint Rewrite Znth_map_Vubyte using list_solve : norm entailer_rewrite. *)
Local Open Scope nat.
Fixpoint map2 {A B C: Type} (f: A -> B -> C) (al: list A) (bl: list B) : list C :=
match al, bl with
| a::al', b::bl' => f a b :: map2 f al' bl'
| _, _ => nil
end.
Local Open Scope Z.
Definition roundup (a b : Z) := (a + (b-1))/b*b.
(*Definition isbyteZ (i: Z) := (0 <= i < 256)%Z. *)
Definition Shr b x := Int.shru x (Int.repr b).

Lemma byte_testbit:
forall i j, j >= 8 -> Z.testbit (Byte.unsigned i) j = false.