int main() { const char* string = (char *)malloc(50); const char* sub = (char *)malloc(19); int a = 8; float b = 9.4444; int c = 2; int d; printf("Before swapping: a = %d c = %d\n", a , c); a = a + c; c = a - c; a = a - c; printf("After swapping: a = %d c = %d\n", a , c); string = "This is the company namded apple inc"; sub = "is"; printf("Substring: %d\n", isSubstring(string, sub)); printf("Position of the MSB is: %d\n", msbPos(3)); printf("Is bit set: %d\n", isBitset(8,4)); printf("%x to little endian %x\n", a, BigToLittle(a)); printf("%d is a power of 2: %d\n", a ,isPowerof2(a)); printf("%s after reversed: %s\n", string, reverse(string)); printf("%s is palindrome: %d\n", string, isPalindrome(string)); printf("%d is a prime number: %d\n",a, isPrimeNumber(a)); primeNumber(20); printf("\nFibonacci Series: "); fibonacci(15); printf("\n"); printf("Factorial of %d: %d\n", a, factorial(a)); printf("%s after reversing: %s\n", string, reverseString(string)); printf("Nearest int of %f is: %d\n", b, nearestInt(b)); printf("%d", (-1%8)); return 0; }
bool AliasIdSet::test(uint32_t id) const { if (isBitset()) { if (id <= BitsetMax) { return m_bits & (1ull << id); } return hasUpperRange(); } // Big integer. return m_bits == id; }