Overview
Comment: | smaz-tools: new version of Worst_Index limited to a range |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
5388213f83214bf59fadbdcc5940ff39 |
User & Date: | nat on 2017-05-16 21:25:57 |
Other Links: | manifest | tags |
Context
2017-05-17
| ||
21:44 | tools/smaz: use the new version of Worst_Index check-in: 6eaac2a01c user: nat tags: trunk | |
2017-05-16
| ||
21:25 | smaz-tools: new version of Worst_Index limited to a range check-in: 5388213f83 user: nat tags: trunk | |
2017-05-15
| ||
21:34 | smaz_generic-tools: new version of Worst_Index limited to a range check-in: 579aa9f314 user: nat tags: trunk | |
Changes
Modified src/natools-smaz-tools.adb from [743fac26d5] to [a89c042be4].
︙ | ︙ | |||
915 916 917 918 919 920 921 | Score => Score (Word_Maps.Element (Cursor), Word'Length, Method)); end To_Scored_Word; function Worst_Index (Dict : in Dictionary; Counts : in Dictionary_Counts; | | > | | | | 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 | Score => Score (Word_Maps.Element (Cursor), Word'Length, Method)); end To_Scored_Word; function Worst_Index (Dict : in Dictionary; Counts : in Dictionary_Counts; Method : in Methods.Enum; First, Last : in Ada.Streams.Stream_Element) return Ada.Streams.Stream_Element is Result : Ada.Streams.Stream_Element := First; Worst_Score : Score_Value := Score (Dict, Counts, First, Method); S : Score_Value; begin for I in First + 1 .. Last loop S := Score (Dict, Counts, I, Method); if S < Worst_Score then Result := I; Worst_Score := S; end if; end loop; return Result; end Worst_Index; end Natools.Smaz.Tools; |
Modified src/natools-smaz-tools.ads from [43292e7007] to [8aafac2261].
︙ | ︙ | |||
202 203 204 205 206 207 208 209 210 211 212 | Corpus_Entry : in String; Compressed_Size : in out Ada.Streams.Stream_Element_Count; Counts : in out Dictionary_Counts); -- Compress all strings of Corpus, returning the total number of -- compressed bytes and the number of uses for each dictionary -- element. function Worst_Index (Dict : in Dictionary; Counts : in Dictionary_Counts; Method : in Methods.Enum) | > > > > > > > > > | > | | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | Corpus_Entry : in String; Compressed_Size : in out Ada.Streams.Stream_Element_Count; Counts : in out Dictionary_Counts); -- Compress all strings of Corpus, returning the total number of -- compressed bytes and the number of uses for each dictionary -- element. function Worst_Index (Dict : in Dictionary; Counts : in Dictionary_Counts; Method : in Methods.Enum; First, Last : in Ada.Streams.Stream_Element) return Ada.Streams.Stream_Element with Pre => Last in First .. Dict.Dict_Last; -- Return the element with worst score in the whole directionary function Worst_Index (Dict : in Dictionary; Counts : in Dictionary_Counts; Method : in Methods.Enum) return Ada.Streams.Stream_Element is (Worst_Index (Dict, Counts, Method, 0, Dict.Dict_Last)); -- Return the element with worst score in the whole directionary type Score_Value is range 0 .. 2 ** 31 - 1; function Score_Encoded (Count : in String_Count; Length : in Positive) return Score_Value is (Score_Value (Count) * Score_Value (Length)); |
︙ | ︙ |