File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -54,8 +54,9 @@ typedef struct {
54
54
/* true if x is a power of 2 */
55
55
#define IS_POWEROF2 (x ) ((((x) -1) & (x)) == 0)
56
56
#define RING_SIZE_MASK (unsigned) (0x0fffffff) /**< Ring size mask */
57
- #define ALIGN_FLOOR (val , align ) \
58
- (typeof(val))((val) & (~((typeof(val))((align) -1))))
57
+ #define ALIGN_CEIL (val , align ) \
58
+ (typeof(val))((val) + (-(typeof(val))(val) & ((align) -1)))
59
+
59
60
60
61
/**
61
62
* Calculate the memory size needed for a ring buffer.
@@ -80,7 +81,7 @@ ssize_t ringbuf_get_memsize(const unsigned count)
80
81
return - EINVAL ;
81
82
82
83
ssize_t sz = sizeof (ringbuf_t ) + count * sizeof (void * );
83
- sz = ALIGN_FLOOR (sz , CACHE_LINE_SIZE );
84
+ sz = ALIGN_CEIL (sz , CACHE_LINE_SIZE );
84
85
return sz ;
85
86
}
86
87
You can’t perform that action at this time.
0 commit comments