diff options
author | Tristan Gingold | 2015-02-14 07:07:38 +0100 |
---|---|---|
committer | Tristan Gingold | 2015-02-14 07:07:38 +0100 |
commit | 54b28e858d32e4afa079ab3af086e99ad54becf6 (patch) | |
tree | 48423ef5a62c8ba7dae9897d25e869be6c5ad9d6 /src/str_table.adb | |
parent | 35e2f4cdd1ddcc663daed30681c24494824eb13e (diff) | |
download | ghdl-54b28e858d32e4afa079ab3af086e99ad54becf6.tar.gz ghdl-54b28e858d32e4afa079ab3af086e99ad54becf6.tar.bz2 ghdl-54b28e858d32e4afa079ab3af086e99ad54becf6.zip |
str_table: pack elements to reduce size.
Diffstat (limited to 'src/str_table.adb')
-rw-r--r-- | src/str_table.adb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/str_table.adb b/src/str_table.adb index 85f7700..4b4e15b 100644 --- a/src/str_table.adb +++ b/src/str_table.adb @@ -18,9 +18,13 @@ with GNAT.Table; package body Str_Table is + -- Be sure the elements are packed. + type El_Nat8 is new Nat8; + for El_Nat8'Size use 8; + package String8_Table is new GNAT.Table (Table_Index_Type => String8_Id, - Table_Component_Type => Nat8, + Table_Component_Type => El_Nat8, Table_Low_Bound => Null_String8 + 1, Table_Initial => 1024, Table_Increment => 100); @@ -35,7 +39,7 @@ package body Str_Table is procedure Append_String8 (El : Nat8) is begin - String8_Table.Append (El); + String8_Table.Append (El_Nat8 (El)); end Append_String8; procedure Append_String8_Char (El : Character) is @@ -50,12 +54,12 @@ package body Str_Table is function Element_String8 (Id : String8_Id; N : Pos32) return Nat8 is begin - return String8_Table.Table (Id + String8_Id (N - 1)); + return Nat8 (String8_Table.Table (Id + String8_Id (N - 1))); end Element_String8; procedure Set_Element_String8 (Id : String8_Id; N : Pos32; Val : Nat8) is begin - String8_Table.Table (Id + String8_Id (N - 1)) := Val; + String8_Table.Table (Id + String8_Id (N - 1)) := El_Nat8 (Val); end Set_Element_String8; function Char_String8 (Id : String8_Id; N : Pos32) return Character is @@ -73,6 +77,11 @@ package body Str_Table is return Res; end String_String8; + function String8_Address (Id : String8_Id) return System.Address is + begin + return String8_Table.Table (Id)'Address; + end String8_Address; + procedure Initialize is begin String8_Table.Free; |