Commit 9ed3ee5
committed
Simplify initialization of incremental hash state
The standalone functions fasthash{32,64} use length for two purposes:
how many bytes to hash, and how to perturb the internal seed.
Developers using the incremental interface may not know the length
ahead of time (e.g. for C strings). In this case, it's advised to
pass length to the finalizer, but initialization still needed some
length up front, in the form of a placeholder macro.
Separate the concerns by having the standalone functions perturb the
internal seed themselves from their own length parameter, allowing
to remove "len" from fasthash_init(), as well as the placeholder macro.
Discussion: https://postgr.es/m/CANWCAZbTUk2LOyhsFo33gjLyLAHZ7ucXCi5K9u%3D%2BPtnTShDKtw%40mail.gmail.com1 parent 1f61680 commit 9ed3ee5
File tree
2 files changed
+9
-12
lines changed- src
- backend/catalog
- include/common
2 files changed
+9
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | | - | |
| 259 | + | |
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 73 | + | |
77 | 74 | | |
78 | 75 | | |
79 | 76 | | |
| |||
89 | 86 | | |
90 | 87 | | |
91 | 88 | | |
92 | | - | |
93 | 89 | | |
94 | 90 | | |
95 | 91 | | |
96 | 92 | | |
97 | | - | |
98 | | - | |
99 | 93 | | |
100 | 94 | | |
101 | 95 | | |
102 | | - | |
| 96 | + | |
103 | 97 | | |
104 | 98 | | |
105 | | - | |
| 99 | + | |
106 | 100 | | |
107 | 101 | | |
108 | 102 | | |
| |||
328 | 322 | | |
329 | 323 | | |
330 | 324 | | |
331 | | - | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
332 | 329 | | |
333 | 330 | | |
334 | 331 | | |
| |||
0 commit comments