|
@@ -5,3 +5,18 @@
|
|
|
regex reg(R"[a-z]+");
|
|
|
string str("couCOU");
|
|
|
bool match = regex_match(str, reg));
|
|
|
+
|
|
|
+// builtins
|
|
|
+__gcd(x, y);
|
|
|
+// for __builtin_*, add suffix l for long, ll for long long
|
|
|
+__builtin_ffs(int);// 1 + least significant 1-bit
|
|
|
+// __builtin_ffs(1010b) = 2
|
|
|
+// __builtin_ffs(0) = -1
|
|
|
+__builtin_clz(unsigned int) // number of leading 0-bits
|
|
|
+// __builtin_clz(0..010100) = 27
|
|
|
+// __builtin_clz(0) is undefined
|
|
|
+__builtin_ctz(unsigned int) // number of trailing 0-bits
|
|
|
+// __builtin_ctz(0..010100) = 2
|
|
|
+// __builtin_ctz(0) is undefined
|
|
|
+__builtin_popcount(int) // number of 1-bits
|
|
|
+// __builtin_popcount(0110b) = 2
|