Category: integer
In C/C++, if you want to clear an array by filling a byte-value, you can use the following: void * __cdecl memset(void *_Dst, int Val, size_t _Size) This allows …
To count the number of leading zeros for a integer, we can use the following intuitive (bruteforce) method to increment the number of zeros until a first one (from …
In Java Math Package, there is a pow function with returns double type. However, we can speed up this if only integer (long type) parameters are required, i.e. compute integer power …
Given a signed-integer, we can use the following straightforward method to judge it is the power of two inline bool check1(int i) { if (i < 1) return false; …
A bit is set if it is ‘1’. To count how many ‘set’ bits in a 32-bit integer (signed or unsigned), we can use the following straightforward method: inline …