I am updating an existing library in Java I have to connect to MySQL 8 but the source code documentation has a #DEFINE I don't understand. I'm looking specifically at the client capability flags at https://dev.mysql.com/doc/dev/mysql-server/latest/group__group__cs__capabilities__flags.html.
Some of the capability flags show the decimal value so I can convert them to unix for easier bitmasking but there's some flags like CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS
which has the value of (1UL << 22)
.
I have no idea what (1UL << 22)
means to be able convert that to something I can use in java.
Generally speaking, (1UL << 22)
means 1 shifted left 22 times within an Unsigned Long.
That is 2^22, that is 4*1024*1024.
In your case CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS
is just a flag that is enable, in its specific unsigned long register, if bit 22 of the register is 1 (bits count starts with 0).