Add Is_Power_Of_2 functions
diff --git a/src/filo.ads b/src/filo.ads
index 96f4281..2e02436 100644
--- a/src/filo.ads
+++ b/src/filo.ads
@@ -38,4 +38,14 @@
Buf'First <= Index_Type32'Last - Off and
Buf'First + Off + 3 <= Buf'Last;
+ generic
+ type T is mod <>;
+ function Gen_Is_Power_Of_2 (Val : T) return Boolean;
+ function Gen_Is_Power_Of_2 (Val : T) return Boolean
+ is
+ (Val /= 0 and (Val and (Val - 1)) = 0);
+
+ function Is_Power_Of_2 is new Gen_Is_Power_Of_2 (Unsigned_16);
+ function Is_Power_Of_2 is new Gen_Is_Power_Of_2 (Unsigned_32);
+
end FILO;