------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. -- -- -- -- (C) 2018 Stanislav Datskovskiy ( www.loper-os.org ) -- -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html -- -- -- -- You do not have, nor can you ever acquire the right to use, copy or -- -- distribute this software ; Should you use this software for any purpose, -- -- or copy and distribute it to anyone or in any manner, you are breaking -- -- the laws of whatever soi-disant jurisdiction, and you promise to -- -- continue doing so for the indefinite future. In any case, please -- -- always : read and understand any software ; verify any PGP signatures -- -- that you use - for any purpose. -- -- -- -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Words; use Words; with FZ_Type; use FZ_Type; package FZ_Shift is pragma Pure; -------------------------------------------------------------- -- WARNING: These ops are not precondition-shielded, and -- must never be directly exposed via the user API ( ffa.ads ) -------------------------------------------------------------- -------------------------------------------------------------- -- Shift Right -------------------------------------------------------------- -- ShiftedN := N >> Count (with Overflow Input and Output) -- WARNING: OF_in MUST be of valid bit-width for the shift! procedure FZ_ShiftRight_O_I(N : in FZ; ShiftedN : out FZ; Count : in WBit_Index; Overflow : out Word; OF_in : in Word); pragma Inline_Always(FZ_ShiftRight_O_I); -- ShiftedN := N >> Count (with Overflow Output only) procedure FZ_ShiftRight_O(N : in FZ; ShiftedN : out FZ; Count : in WBit_Index; Overflow : out Word); pragma Inline_Always(FZ_ShiftRight_O); -- ShiftedN := N >> Count (no Overflow output or input) procedure FZ_ShiftRight(N : in FZ; ShiftedN : out FZ; Count : in WBit_Index); pragma Inline_Always(FZ_ShiftRight); -------------------------------------------------------------- -- Shift Left -------------------------------------------------------------- -- ShiftedN := N << Count (with Overflow Input and Output) -- WARNING: OF_in MUST be of valid bit-width for the shift! procedure FZ_ShiftLeft_O_I(N : in FZ; ShiftedN : out FZ; Count : in WBit_Index; Overflow : out Word; OF_in : in Word); pragma Inline_Always(FZ_ShiftLeft_O_I); -- ShiftedN := N << Count (with Overflow Output only) procedure FZ_ShiftLeft_O(N : in FZ; ShiftedN : out FZ; Count : in WBit_Index; Overflow : out Word); pragma Inline_Always(FZ_ShiftLeft_O); -- ShiftedN := N << Count (no Overflow output or input) procedure FZ_ShiftLeft(N : in FZ; ShiftedN : out FZ; Count : in WBit_Index); pragma Inline_Always(FZ_ShiftLeft); end FZ_Shift;