> Where is the ~0UL coming from, is it part ot stdbool or something else.
It has nothing to do with <stdbool.h>. The UL is a suffix that makes the constant into an unsigned long. An integral constant without a suffix such as 57 is a (signed) int by default, while 57U is an unsigned int, and 57UL is an unsigned long. A floating-point constant such as 1.0 with a decimal point but no suffix is double by default, while 1.0F is a float, and 1.0L is a long double.
Edit: This is not a complete list, and you can also use the lower-case version of these letters, though the upper-case version is usually easier to read properly, for example 57L is a long int, and so is 57l, but the latter looks like 571, so you should use L.