X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fhmap.h;h=1809a91b5f85b5b1f4c97fcc5085f4d15bc5c9f9;hb=dc81071d9fe21beaead51a9c0a8d87fbefbfcf56;hp=67c8e7041d8bafbf2142cfca42171097b2fe1a70;hpb=34e63086edddcae06d7c1a4fa84fec0861e50758;p=openvswitch diff --git a/lib/hmap.h b/lib/hmap.h index 67c8e704..1809a91b 100644 --- a/lib/hmap.h +++ b/lib/hmap.h @@ -108,6 +108,14 @@ hmap_count(const struct hmap *hmap) return hmap->n; } +/* Returns the maximum number of nodes that 'hmap' may hold before it should be + * rehashed. */ +static inline size_t +hmap_capacity(const struct hmap *hmap) +{ + return hmap->mask * 2 + 1; +} + /* Returns true if 'hmap' currently contains no nodes, * false otherwise. */ static inline bool