‘and’ (boolean) vs ‘&’ (bitwise) – Why difference in behavior with lists vs numpy arrays?

and tests whether both expressions are logically True while & (when used with True/False values) tests if both are True. In Python, empty built-in objects are typically treated as logically False while non-empty built-ins are logically True. This facilitates the common use case where you want to do something if a list is empty and … Read more

What is the fastest/most efficient way to find the highest set bit (msb) in an integer in C?

GCC has: — Built-in Function: int __builtin_clz (unsigned int x) Returns the number of leading 0-bits in X, starting at the most significant bit position. If X is 0, the result is undefined. — Built-in Function: int __builtin_clzl (unsigned long) Similar to `__builtin_clz’, except the argument type is `unsigned long’. — Built-in Function: int __builtin_clzll … Read more