[map] Fix TODO

This commit is contained in:
Behdad Esfahbod 2019-04-24 10:53:16 -04:00
parent 4c6136e976
commit 22da12318a
5 changed files with 9 additions and 8 deletions

View File

@ -34,11 +34,9 @@
* hb_hashmap_t * hb_hashmap_t
*/ */
/* TODO if K/V is signed integer, -1 is not a good default.
* Don't know how to get to -MAX using bit work. */
template <typename K, typename V, template <typename K, typename V,
K kINVALID = hb_is_pointer (K) ? 0 : (K) -1, K kINVALID = hb_is_pointer (K) ? 0 : hb_is_signed (K) ? hb_int_min (K) : (K) -1,
V vINVALID = hb_is_pointer (V) ? 0 : (V) -1> V vINVALID = hb_is_pointer (V) ? 0 : hb_is_signed (V) ? hb_int_min (V) : (V) -1>
struct hb_hashmap_t struct hb_hashmap_t
{ {
HB_DELETE_COPY_ASSIGN (hb_hashmap_t); HB_DELETE_COPY_ASSIGN (hb_hashmap_t);

View File

@ -138,6 +138,12 @@ template <> struct hb_is_signed<uint32_t> { enum { value = false }; };
template <> struct hb_is_signed<uint64_t> { enum { value = false }; }; template <> struct hb_is_signed<uint64_t> { enum { value = false }; };
#define hb_is_signed(T) hb_is_signed<T>::value #define hb_is_signed(T) hb_is_signed<T>::value
template <typename T> struct hb_int_min { static constexpr T value = 0; };
template <> struct hb_int_min<char> { static constexpr char value = CHAR_MIN; };
template <> struct hb_int_min<int> { static constexpr int value = INT_MIN; };
template <> struct hb_int_min<long> { static constexpr long value = LONG_MIN; };
#define hb_int_min(T) hb_int_min<T>::value
template <bool is_signed> struct hb_signedness_int; template <bool is_signed> struct hb_signedness_int;
template <> struct hb_signedness_int<false> { typedef unsigned int value; }; template <> struct hb_signedness_int<false> { typedef unsigned int value; };
template <> struct hb_signedness_int<true> { typedef signed int value; }; template <> struct hb_signedness_int<true> { typedef signed int value; };

View File

@ -26,7 +26,6 @@
#include "hb-ot-cff1-table.hh" #include "hb-ot-cff1-table.hh"
#include "hb-cff1-interp-cs.hh" #include "hb-cff1-interp-cs.hh"
#include <limits.h>
using namespace CFF; using namespace CFF;

View File

@ -26,7 +26,6 @@
#include "hb-ot-cff2-table.hh" #include "hb-ot-cff2-table.hh"
#include "hb-cff2-interp-cs.hh" #include "hb-cff2-interp-cs.hh"
#include <limits.h>
using namespace CFF; using namespace CFF;

View File

@ -167,8 +167,7 @@
#include "hb-aat.h" #include "hb-aat.h"
#define HB_AAT_H_IN #define HB_AAT_H_IN
#include "hb-aat.h" #include <limits.h>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h> #include <stddef.h>