12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182(**************************************************************************)(* This file is part of BINSEC. *)(* *)(* Copyright (C) 2016-2026 *)(* CEA (Commissariat à l'énergie atomique et aux énergies *)(* alternatives) *)(* *)(* you can redistribute it and/or modify it under the terms of the GNU *)(* Lesser General Public License as published by the Free Software *)(* Foundation, version 2.1. *)(* *)(* It is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU Lesser General Public License for more details. *)(* *)(* See the GNU Lesser General Public License version 2.1 *)(* for more details (enclosed in the file licenses/LGPLv2.1). *)(* *)(**************************************************************************)moduletypeSize=sigtypet=privateNatural.tvalcreate:int->tvalof_string:string->tvalof_int32:int32->tvalto_int:t->intvaleq:t->t->boolvalpp:Format.formatter->t->unitvalpp_hex:Format.formatter->t->unitvaladd:t->t->tvalsub:t->t->tvaldiv:t->t->tvalmul:t->t->tvalpred:t->tvalis_zero:t->boolendmoduleCommonSize=structincludeNaturalletpp_hexppft=Format.fprintfppf"%x"(to_intt)letof_strings=int_of_strings|>createletof_int32n=Int32.to_intn|>createendmoduleBit=structincludeCommonSizeletbits1=create1letbits2=create2letbits4=create4letbits8=create8letbits16=create16letbits32=create32letbits64=create64letbits80=create80letbits128=create128letbits256=create256letbits512=create512endmoduleByte=structincludeCommonSizeletbytesize=Natural.create8letto_bitsizen=mulnbytesizeletof_bitsizen=assert(to_intnmod(bytesize:>int)=0);divnbytesizeletunsafe_of_bitsn=of_bitsize(createn)letone=create1lettwo=create2letfour=create4leteight=create8letfifteen=create15letsixteen=create16letthirtytwo=create32end