File tree 1 file changed +14
-14
lines changed
1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,20 @@ struct instance_map_shard {
151
151
152
152
static_assert (sizeof (instance_map_shard) % 64 == 0,
153
153
"instance_map_shard size is not a multiple of 64 bytes");
154
+
155
+ inline uint64_t round_up_to_next_pow2 (uint64_t x) {
156
+ // Round-up to the next power of two.
157
+ // See https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
158
+ x--;
159
+ x |= (x >> 1 );
160
+ x |= (x >> 2 );
161
+ x |= (x >> 4 );
162
+ x |= (x >> 8 );
163
+ x |= (x >> 16 );
164
+ x |= (x >> 32 );
165
+ x++;
166
+ return x;
167
+ }
154
168
#endif
155
169
156
170
// / Internal data structure used to track registered instances and types.
@@ -456,20 +470,6 @@ inline object get_python_state_dict() {
456
470
return state_dict;
457
471
}
458
472
459
- inline uint64_t round_up_to_next_pow2 (uint64_t x) {
460
- // Round-up to the next power of two.
461
- // See https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
462
- x--;
463
- x |= (x >> 1 );
464
- x |= (x >> 2 );
465
- x |= (x >> 4 );
466
- x |= (x >> 8 );
467
- x |= (x >> 16 );
468
- x |= (x >> 32 );
469
- x++;
470
- return x;
471
- }
472
-
473
473
template <typename InternalsType>
474
474
inline InternalsType **get_internals_pp_from_capsule_in_state_dict (dict &state_dict,
475
475
char const *state_dict_key) {
You can’t perform that action at this time.
0 commit comments