raw
ffa_ch11_tuning_a...    1 ------------------------------------------------------------------------------
ffa_ch11_tuning_a... 2 ------------------------------------------------------------------------------
ffa_ch11_tuning_a... 3 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
ffa_ch11_tuning_a... 4 -- --
ffa_ch11_tuning_a... 5 -- (C) 2018 Stanislav Datskovskiy ( www.loper-os.org ) --
ffa_ch11_tuning_a... 6 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
ffa_ch11_tuning_a... 7 -- --
ffa_ch11_tuning_a... 8 -- You do not have, nor can you ever acquire the right to use, copy or --
ffa_ch11_tuning_a... 9 -- distribute this software ; Should you use this software for any purpose, --
ffa_ch11_tuning_a... 10 -- or copy and distribute it to anyone or in any manner, you are breaking --
ffa_ch11_tuning_a... 11 -- the laws of whatever soi-disant jurisdiction, and you promise to --
ffa_ch11_tuning_a... 12 -- continue doing so for the indefinite future. In any case, please --
ffa_ch11_tuning_a... 13 -- always : read and understand any software ; verify any PGP signatures --
ffa_ch11_tuning_a... 14 -- that you use - for any purpose. --
ffa_ch11_tuning_a... 15 -- --
ffa_ch11_tuning_a... 16 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
ffa_ch11_tuning_a... 17 ------------------------------------------------------------------------------
ffa_ch11_tuning_a... 18 ------------------------------------------------------------------------------
ffa_ch11_tuning_a... 19
ffa_ch11_tuning_a... 20 with Words; use Words;
ffa_ch11_tuning_a... 21 with FZ_Type; use FZ_Type;
ffa_ch11_tuning_a... 22 with FZ_Lim; use FZ_Lim;
ffa_ch11_tuning_a... 23
ffa_ch11_tuning_a... 24
ffa_ch11_tuning_a... 25 package FZ_IO is
ffa_ch11_tuning_a... 26
ffa_ch11_tuning_a... 27 pragma Pure;
ffa_ch11_tuning_a... 28
ffa_ch11_tuning_a... 29 -- Expand FZ N by nibble D, and determine whether this operation overflowed
ffa_ch11_tuning_a... 30 procedure FZ_Insert_Bottom_Nibble(N : in out FZ;
ffa_ch11_tuning_a... 31 D : in Nibble;
ffa_ch11_tuning_a... 32 Overflow : out WBool);
ffa_ch11_tuning_a... 33
ffa_ch11_tuning_a... 34 -- A count of ASCII chars representing a humanized FZ:
ffa_ch11_tuning_a... 35 subtype Char_Count is
ffa_ch11_tuning_a... 36 Positive range Nibbleness * FZ_Minimal_Wordness .. Positive'Last;
ffa_ch11_tuning_a... 37
ffa_ch11_tuning_a... 38 -- Determine the number of ASCII characters required to represent N
ffa_ch11_tuning_a... 39 function FZ_ASCII_Length(N : in FZ) return Char_Count;
ffa_ch11_tuning_a... 40 pragma Inline_Always(FZ_ASCII_Length);
ffa_ch11_tuning_a... 41
ffa_ch11_tuning_a... 42 -- Hex Digits (currently used only in FZ_To_Hex_String)
ffa_ch11_tuning_a... 43 HexDigs : constant array(0 .. 15) of Character := "0123456789ABCDEF";
ffa_ch11_tuning_a... 44
ffa_ch11_tuning_a... 45 -- Write an ASCII hex representation of N into existing string buffer S
ffa_ch11_tuning_a... 46 procedure FZ_To_Hex_String(N : in FZ; S : out String)
ffa_ch11_tuning_a... 47 with Pre => S'Length = FZ_ASCII_Length(N);
ffa_ch11_tuning_a... 48
ffa_ch11_tuning_a... 49 end FZ_IO;