declare
-- Determine the size in BITS of the block necessary to contain
-- the whole string.
+ -- Since we are dealing with strings indexed by natural, there
+ -- is no risk of overflow when using a Long_Long_Integer.
- Block_Size : constant Natural :=
- Integer (Item'Last - Item'First + 1) * ET_Size;
+ Block_Size : constant Long_Long_Integer :=
+ Item'Length * Long_Long_Integer (ET_Size);
-- Item can be larger than what the default block can store,
- -- determine the number of whole reads necessary to read the
+ -- determine the number of whole writes necessary to output the
-- string.
- Blocks : constant Natural := Block_Size / Default_Block_Size;
+ Blocks : constant Natural :=
+ Natural (Block_Size / Long_Long_Integer (Default_Block_Size));
-- The size of Item may not be a multiple of the default block
- -- size, determine the size of the remaining chunk in BITS.
+ -- size, determine the size of the remaining chunk.
Rem_Size : constant Natural :=
- Block_Size mod Default_Block_Size;
+ Natural
+ (Block_Size mod Long_Long_Integer (Default_Block_Size));
-- String indexes
declare
-- Determine the size in BITS of the block necessary to contain
-- the whole string.
+ -- Since we are dealing with strings indexed by natural, there
+ -- is no risk of overflow when using a Long_Long_Integer.
- Block_Size : constant Natural := Item'Length * ET_Size;
+ Block_Size : constant Long_Long_Integer :=
+ Item'Length * Long_Long_Integer (ET_Size);
-- Item can be larger than what the default block can store,
-- determine the number of whole writes necessary to output the
-- string.
- Blocks : constant Natural := Block_Size / Default_Block_Size;
+ Blocks : constant Natural :=
+ Natural (Block_Size / Long_Long_Integer (Default_Block_Size));
-- The size of Item may not be a multiple of the default block
-- size, determine the size of the remaining chunk.
Rem_Size : constant Natural :=
- Block_Size mod Default_Block_Size;
+ Natural
+ (Block_Size mod Long_Long_Integer (Default_Block_Size));
-- String indexes