* Converts a cryptographic hash (e.g. SHA-1) into an int-sized hash code * for use in hash tables. Cryptographic hashes are supposed to have * uniform distribution, so in contrast to `memhash()`, this just copies * the first `sizeof(int)` bytes without shuffling any bits. Note that * the results will be different on big-endian and little-endian * platforms, so they should not be stored or tra
| 442 | * platforms, so they should not be stored or transferred over the net. |
| 443 | */ |
| 444 | static inline unsigned int oidhash(const struct object_id *oid) |
| 445 | { |
| 446 | /* |
| 447 | * Equivalent to 'return *(unsigned int *)oid->hash;', but safe on |
| 448 | * platforms that don't support unaligned reads. |
| 449 | */ |
| 450 | unsigned int hash; |
| 451 | memcpy(&hash, oid->hash, sizeof(hash)); |
| 452 | return hash; |
| 453 | } |
| 454 | |
| 455 | static inline int is_null_oid(const struct object_id *oid) |
| 456 | { |
no outgoing calls
no test coverage detected