Skip to content

Commit f4e1611

Browse files
Nicolas Pitrenashif
authored andcommitted
lib/os/heap: no need to over-mask
bmask already represents the intersection of h->avail_buckets and wanted buckets. Signed-off-by: Nicolas Pitre <[email protected]>
1 parent a54e101 commit f4e1611

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/os/heap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ static chunkid_t alloc_chunk(struct z_heap *h, size_t sz)
207207
*/
208208
size_t bmask = h->avail_buckets & ~((1 << (bi + 1)) - 1);
209209

210-
if ((bmask & h->avail_buckets) != 0U) {
211-
int minbucket = __builtin_ctz(bmask & h->avail_buckets);
210+
if (bmask != 0U) {
211+
int minbucket = __builtin_ctz(bmask);
212212
chunkid_t c = h->buckets[minbucket].next;
213213

214214
free_list_remove_bidx(h, c, minbucket);

0 commit comments

Comments
 (0)