-
+ 81A4BF46ABD4B92F58B791872C94193606E9847F7C232AA604F91B71412F0B9732D23BE295810596355B68B8111EF5102BB7778DCB2FE987C948490A95B49CCD
ffa/libffa/words.ads
(0 . 0)(1 . 46)
1030 ------------------------------------------------------------------------------
1031 ------------------------------------------------------------------------------
1032 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
1033 -- --
1034 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
1035 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
1036 -- --
1037 -- You do not have, nor can you ever acquire the right to use, copy or --
1038 -- distribute this software ; Should you use this software for any purpose, --
1039 -- or copy and distribute it to anyone or in any manner, you are breaking --
1040 -- the laws of whatever soi-disant jurisdiction, and you promise to --
1041 -- continue doing so for the indefinite future. In any case, please --
1042 -- always : read and understand any software ; verify any PGP signatures --
1043 -- that you use - for any purpose. --
1044 -- --
1045 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
1046 ------------------------------------------------------------------------------
1047 ------------------------------------------------------------------------------
1048
1049 with Iron;
1050
1051 package Words is
1052
1053 pragma Pure;
1054
1055 -- The most fundamental fact about Word: width.
1056 Bitness : constant Positive := Iron.MachineBitness;
1057
1058 -- It is possible to calculate BitnessLog2 at elaboration time,
1059 -- but we will avoid having ~any~ elaboration at all in FFA.
1060 BitnessLog2 : constant Positive := Iron.MachineBitnessLog2;
1061
1062 -- The Word width, expressed in ~bytes~:
1063 Byteness : constant Positive := Bitness / Iron.ByteBits;
1064
1065 -- What kind of words to use. Must be machine-word or smaller.
1066 type Word is mod 2**Bitness;
1067 for Word'Size use Bitness;
1068
1069 -- The very same Word, but its only legal values are 0 and 1.
1070 subtype WBool is Word range 0 .. 1;
1071
1072 -- When we must refer to individual bit positions of a machine word:
1073 subtype WBit_Index is Natural range 0 .. Bitness - 1;
1074
1075 end Words;