History

nextipow2: simplify

Sigrid Solveig Haflínudóttir committed 11 months ago

Commit ff148801 parent 6924b822 files · +2 −5Browse files

Unified · Split

2 files
  1. src/hashing.c +2 −3
  2. src/sl.h +0 −2
src/hashing.c+2−3
@@ -5,8 +5,6 @@ · 4 unmodified lines
55 sl_v
66 nextipow2(sl_v a)
77 {
8− if(sl_unlikely(a == 0))
9− return 1;
108 a |= a >> 1;
119 a |= a >> 2;
1210 a |= a >> 4;
@@ -16,7 +14,8 @@ nextipow2(sl_v a) · 3 unmodified lines
1614 a |= a >> 32;
1715 #endif
1816 a++;
19− return a ? a : TOP_BIT;
17+ assert(a != 0);
18+ return a;
2019 }
2120
2221 sl_v
src/sl.h+0−2
@@ -73,14 +73,12 @@ typedef enum { · 72 unmodified lines
7373 typedef s64int sl_fx;
7474 #define FIXNUM_BITS (64-TAG_BITS)
7575 #define UNBOXED_BITS (64-TAG_EXT_BITS)
76−#define TOP_BIT (1ULL<<63)
7776 #define T_FIXNUM T_S64
7877 #define PRIdFIXNUM PRId64
7978 #else
8079 typedef s32int sl_fx;
8180 #define FIXNUM_BITS (32-TAG_BITS)
8281 #define UNBOXED_BITS (32-TAG_EXT_BITS)
83−#define TOP_BIT (1U<<31)
8482 #define T_FIXNUM T_S32
8583 #define PRIdFIXNUM PRId32
8684 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t