Changeset 34120f10 in mainline for common/include/adt/hash.h


Ignore:
Timestamp:
2023-10-27T19:38:31Z (14 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, topic/msim-upgrade, topic/simplify-dev-export
Children:
63ed840
Parents:
c89ae25 (diff), 694ca3d6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge code deduplication work

TL;DR: Added directory /common, which now contains the sole existing
copy of ADT, printf_core, and a few other pieces. Should make changes
to any of those less of a headache.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • common/include/adt/hash.h

    rc89ae25 r34120f10  
    3535#define _LIBC_ADT_HASH_H_
    3636
     37#include <stddef.h>
    3738#include <stdint.h>
    38 #include <types/common.h>
    3939
    4040/** Produces a uniform hash affecting all output bits from the skewed input. */
     
    7878static inline size_t hash_mix(size_t hash)
    7979{
    80 #ifdef __32_BITS__
    81         return hash_mix32(hash);
    82 #elif defined(__64_BITS__)
    83         return hash_mix64(hash);
    84 #else
    85 #error Unknown size_t size - cannot select proper hash mix function.
    86 #endif
     80        if (sizeof(long) == 4)
     81                return hash_mix32(hash);
     82        else
     83                return hash_mix64(hash);
    8784}
    8885
Note: See TracChangeset for help on using the changeset viewer.