From eebcc9a322a94556c0d7e804fc1025d26e8fc5c5 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Thu, 18 Jan 2018 13:20:24 +0100 Subject: [PATCH] Add map_clr_at and MAPCLR_AT Clear some bits around the specified bit. --- src/bitmap.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bitmap.h b/src/bitmap.h index c20b48f1..0050a6a4 100644 --- a/src/bitmap.h +++ b/src/bitmap.h @@ -33,6 +33,8 @@ typedef struct _Map { #define MAPCLR(m, n) ((m)->map[(n) >> 3] &= ~(1 << ((n) & 7))) /* test bit */ #define MAPTST(m, n) ((m)->map[(n) >> 3] & (1 << ((n) & 7))) +/* clear some bits at a position */ +#define MAPCLR_AT(m, n) ((m)->map[(n) >> 3] = 0) extern void map_init(Map *m, int n); extern void map_init_clone(Map *t, Map *s); @@ -63,6 +65,10 @@ static inline int map_tst(Map *m, int n) { return MAPTST(m, n); } +static inline void map_clr_at(Map *m, int n) +{ + MAPCLR_AT(m, n); +} #ifdef __cplusplus } -- 2.47.2