-------------------------------------------------------------------- */ * This works on all machines. To be useful, it requires * -- that the key be an array of uint32_t's, and * -- that the size be the number of uint32_t's in the key * * The function jlu32w() is identical to jlu32l() on little-endian * machines, and identical to jlu32b() on big-endian machines, * except that the siz
| 168 | */ |
| 169 | /* -------------------------------------------------------------------- */ |
| 170 | uint32_t jlu32w(uint32_t h, const uint32_t *k, size_t size) |
| 171 | { |
| 172 | uint32_t a = _JLU3_INIT(h, (size * sizeof(*k))); |
| 173 | uint32_t b = a; |
| 174 | uint32_t c = a; |
| 175 | |
| 176 | if (k == NULL) |
| 177 | goto exit; |
| 178 | |
| 179 | /*----------------------------------------------- handle most of the key */ |
| 180 | while (size > 3) { |
| 181 | a += k[0]; |
| 182 | b += k[1]; |
| 183 | c += k[2]; |
| 184 | _JLU3_MIX(a,b,c); |
| 185 | size -= 3; |
| 186 | k += 3; |
| 187 | } |
| 188 | |
| 189 | /*----------------------------------------- handle the last 3 uint32_t's */ |
| 190 | switch (size) { |
| 191 | case 3 : c+=k[2]; |
| 192 | case 2 : b+=k[1]; |
| 193 | case 1 : a+=k[0]; |
| 194 | _JLU3_FINAL(a,b,c); |
| 195 | /* fallthrough */ |
| 196 | case 0: |
| 197 | break; |
| 198 | } |
| 199 | /*---------------------------------------------------- report the result */ |
| 200 | exit: |
| 201 | return c; |
| 202 | } |
| 203 | #endif /* defined(_JLU3_jlu32w) */ |
| 204 | |
| 205 | #if defined(_JLU3_jlu32l) |