File : fz_type.ads


   1 ------------------------------------------------------------------------------
   2 ------------------------------------------------------------------------------
   3 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'.               --
   4 --                                                                          --
   5 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org )                      --
   6 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html     --
   7 --                                                                          --
   8 -- You do not have, nor can you ever acquire the right to use, copy or      --
   9 -- distribute this software ; Should you use this software for any purpose, --
  10 -- or copy and distribute it to anyone or in any manner, you are breaking   --
  11 -- the laws of whatever soi-disant jurisdiction, and you promise to         --
  12 -- continue doing so for the indefinite future. In any case, please         --
  13 -- always : read and understand any software ; verify any PGP signatures    --
  14 -- that you use - for any purpose.                                          --
  15 --                                                                          --
  16 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm .     --
  17 ------------------------------------------------------------------------------
  18 ------------------------------------------------------------------------------
  19 
  20 -- FZ -- the fundamental FZ type: an unsigned integer of fixed width,
  21 -- i.e. a contiguous array of machine words. There is no 'meta'-anything:
  22 -- in particular, there is no normalization nor will there ever be any
  23 -- normalization, nor any provisions for resizing, nor any such thing.
  24 -- Note that endianness is irrelevant, here and elsewhere in FFA.
  25 
  26 with Words; use Words;
  27 
  28 package FZ_Type is
  29    
  30    pragma Pure;
  31    
  32    -- Indices of all indexable items:
  33    type Indices is new Natural;
  34    
  35    -- Index of a particular Word in an FZ:
  36    subtype Word_Index is Indices;
  37    
  38    -- The FZ, in person! I.e. a bignum of permanently fixed bitness.
  39    type FZ is array(Word_Index range <>) of Word;
  40    
  41    -- A count of Words in an FZ (cannot be 0):
  42    subtype Word_Count is Indices range 1 .. Indices'Last;
  43    
  44    -- A count of Bits, anywhere (cannot be 0):
  45    subtype Bit_Count is Positive;
  46    
  47    -- An index of a particular ~bit~ in an FZ:
  48    subtype FZBit_Index is Indices;
  49    
  50 end FZ_Type;