Natools

Check-in [b6557bf0ac]
Login
Overview
Comment:smaz_generic-tools: use Dict_Entry_Length when possible
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b6557bf0ac639997edcfa6e22b91548687fd1e88
User & Date: nat on 2017-05-26 20:02:20
Other Links: manifest | tags
Context
2017-06-12
19:15
string_slices: use an immutable reference to protect from overwriting check-in: 74bf50894a user: nat tags: trunk
2017-05-26
20:02
smaz_generic-tools: use Dict_Entry_Length when possible check-in: b6557bf0ac user: nat tags: trunk
2017-05-25
21:11
tools/smaz: allow Optimization_Round to increase dictionary size check-in: 44c74c875f user: nat tags: trunk
Changes

Modified src/natools-smaz_generic-tools.adb from [ec9ad0d224] to [0b37b2db14].

305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321

      New_Max_Word_Length : Positive := Dict.Max_Word_Length;
   begin
      if Removed_Length = Dict.Max_Word_Length then
         New_Max_Word_Length := 1;
         for I in Dict.Offsets'Range loop
            if I /= Index
              and then Dict_Entry (Dict, I)'Length > New_Max_Word_Length
            then
               New_Max_Word_Length := Dict_Entry (Dict, I)'Length;
            end if;
         end loop;
      end if;

      return Dictionary'
        (Last_Code => Dictionary_Code'Pred (Dict.Last_Code),
         Values_Last => Dict.Values_Last - Removed_Length,







|

|







305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321

      New_Max_Word_Length : Positive := Dict.Max_Word_Length;
   begin
      if Removed_Length = Dict.Max_Word_Length then
         New_Max_Word_Length := 1;
         for I in Dict.Offsets'Range loop
            if I /= Index
              and then Dict_Entry_Length (Dict, I) > New_Max_Word_Length
            then
               New_Max_Word_Length := Dict_Entry_Length (Dict, I);
            end if;
         end loop;
      end if;

      return Dictionary'
        (Last_Code => Dictionary_Code'Pred (Dict.Last_Code),
         Values_Last => Dict.Values_Last - Removed_Length,