|So the bitwise | (OR) which I normally use as || (OR) in if statements can append the bits of 0xB0 to the bits of 0x25 - heck, we're modifying the integer on a binary level to create one single integer of four digits.|
Yes. Conceptually, a bitwise OR is similar to addition, and a bitwise AND is similar to multiplication in ways. You can think of a bitwise OR (|) as the same as a logical OR (||) except it operates on individual bits (1's and 0's) instead of booleans (true's and false's).
|see, so digit is to base-10 as bit is to binary base-2. What are digits called in base-16 hexadecimal?|
Most people don't speak in terms of "digits" in hex. We usually talk in terms of bytes (2 hex digits together). But I have heard the term "nibble" or "nybble" used when referring to a single hex digit. There could be other terms but I don't know them.
|When using strings, << (left shift) is output and >> (right shift) works as input. I guess with C++ operators have multiple meanings. |
Actually, if you want to be 100% accurate, then even the usage of << and >> for streams are actually wrappers around the bit-shift operators. There is no such thing as an "output" or "input" operator in C++, so the designers of the standard library used a technique known as operator overloading
to redefine a particular operator for a particular class type. This definition can be seen here:
When you learn more about the capabilities of classes, you will probably encounter operator overloading again in the future.
|Also, I don't know classes or structs so that confuses me. There might be a YouTube video that explains Unions visually. What the heck is a uint64_t?|
1.) Unions are a data type that is only as large as its largest member. For example:
I will assume here that the size of an int is 4 bytes and the size of a char is 1 byte (which is most common). That means, an object of type MyUnion will be at most 4 bytes. If you write to the int variable "a" inside of a MyUnion object, you actually overrwrite the b variable as well. If you only write to "b", then you overwrite the first byte of the 4 byte MyUnion type (and thus the first byte of a). In essence, a union can be used to pack types together so that only one of the types is used at a time. All of these types occupy the exact same memory location, so that means only the biggest type will determine the size of the entire union.
However, raw unions in C++ are becoming increasingly rare and you will likely not encounter them often.
2.) A uint_64 is an unsigned 64 bit integer type