File : sets2.ads
with Ints, Mods, Lin;
use Ints, Mods, Lin;
generic
L_Last: in Natural; -- less than 64, otherwise use package Sets1
package Sets2 is
pragma Elaborate_Body;
subtype S_Element is Integer range 0 .. 31; -- variable index
subtype S_Set is Int; -- set of variables
type S_SetVec is array(Integer range <>) of S_Set;
function Empty return S_Set;
function Full return S_Set;
function Cardinality(S: S_Set) return Integer;
function Contains(E: S_Element; S: S_Set) return Boolean;
procedure AddElement(E: in S_Element; S: in out S_Set);
procedure AddElements(S: in S_Set; T: in out S_Set);
procedure RmElement(E: in S_Element; S: in out S_Set);
procedure FillGap(N: in Positive; S: in out S_Set);
procedure UnPack(S: in S_Set; U: out IVec; ULast: out Integer);
function Hash(S: S_Set) return PMod;
subtype L_Element is Integer range 0 .. 63; -- halfspace index
subtype L_Set is Int2;
type L_SetVec is array(Integer range <>) of L_Set; -- set of halfspaces
function Empty return L_Set;
function Full return L_Set;
function Cardinality(S: L_Set) return Integer;
function Contains(E: L_Element; S: L_Set) return Boolean;
procedure AddElement(E: in L_Element; S: in out L_Set);
procedure AddElements(S: in L_Set; T: in out L_Set);
procedure RmElement(E: in L_Element; S: in out L_Set);
procedure FillGap(N: in Positive; S: in out L_Set);
function Hash(S: L_Set) return PMod;
pragma Inline (Empty,Full,Cardinality,Contains,AddElement,AddElements,RmElement);
private
function ModP(S: S_Set) return PMod;
function Hash(S: S_Set) return PMod renames ModP;
function ModP(S: L_Set) return PMod;
function Hash(S: L_Set) return PMod renames ModP;
end Sets2;