X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fhash.h;h=026eedaf47b0bd888be2e8625f62312972a73b01;hb=f6d1465cec98fd7e83845d24fb394145bbbcf531;hp=109612fb760fe4d93e21c7ad091b41fd29b2f764;hpb=1f26e79678c9601477c072021598d4d1f5abfb43;p=openvswitch diff --git a/lib/hash.h b/lib/hash.h index 109612fb..026eedaf 100644 --- a/lib/hash.h +++ b/lib/hash.h @@ -22,6 +22,10 @@ #include #include "util.h" +#ifdef __cplusplus +extern "C" { +#endif + /* This is the public domain lookup3 hash by Bob Jenkins from * http://burtleburtle.net/bob/c/lookup3.c, modified for style. */ @@ -81,8 +85,8 @@ static inline uint32_t hash_int(uint32_t x, uint32_t basis) * quality. */ static inline uint32_t hash_boolean(bool x, uint32_t basis) { - enum { P0 = 0xc2b73583 }; /* This is hash_int(1, 0). */ - enum { P1 = 0xe90f1258 }; /* This is hash_int(2, 0). */ + const uint32_t P0 = 0xc2b73583; /* This is hash_int(1, 0). */ + const uint32_t P1 = 0xe90f1258; /* This is hash_int(2, 0). */ return (x ? P0 : P1) ^ HASH_ROT(basis, 1); } @@ -108,4 +112,8 @@ static inline uint32_t hash_pointer(const void *p, uint32_t basis) return hash_int((uint32_t) (uintptr_t) p, basis); } +#ifdef __cplusplus +} +#endif + #endif /* hash.h */