Skip to content

Commit

Permalink
[set-digest] Add operator []. Also auto-initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
behdad committed May 11, 2024
1 parent 3d75d44 commit 5158255
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/hb-set-digest.hh
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,14 @@ struct hb_set_digest_bits_pattern_t
bool may_have (hb_codepoint_t g) const
{ return mask & mask_for (g); }

bool operator [] (hb_codepoint_t g) const
{ return may_have (g); }

private:

static mask_t mask_for (hb_codepoint_t g)
{ return ((mask_t) 1) << ((g >> shift) & (mask_bits - 1)); }
mask_t mask;
mask_t mask = 0;
};

template <typename head_t, typename tail_t>
Expand Down Expand Up @@ -188,6 +191,9 @@ struct hb_set_digest_combiner_t
return head.may_have (g) && tail.may_have (g);
}

bool operator [] (hb_codepoint_t g) const
{ return may_have (g); }

private:
head_t head;
tail_t tail;
Expand Down

0 comments on commit 5158255

Please sign in to comment.