What is the UINT64_C macro in C?

I saw this code:

bool contains_zero_byte(uint64 v) {
  return (((v)-UINT64_C(0x0101010101010101))
        & ~(v)&UINT64_C(0x8080808080808080));

What is UINT64_C(0x0101010101010101) doing? UINT64_C is a macro defined as:

// Appends the correct suffix to a 64-bit unsigned integer literal.
#define UINT64_C(c) c ## ULL

The ## token instructs the preprocessor to “paste together” the tokens on either side of it. So UINT64_C(0x0101010101010101) results in the output 0x0101010101010101ULL.

But what is ULL in 0x0101010101010101ULL? I’ll write more about these suffixes in the next post.

I just released Vidrio, a free app for macOS and Windows to make your screen-sharing awesomely holographic. Vidrio shows your webcam video on your screen, just like a mirror. Then you just share or record your screen with Zoom, QuickTime, or any other app. Vidrio makes your presentations effortlessly engaging, showing your gestures, gazes, and expressions. #1 on Product Hunt. Available for macOS and Windows.

With Vidrio

With generic competitor

More by Jim

Tagged . All content copyright James Fisher 2017. This post is not associated with my employer. Found an error? Edit this page.