On Wed, 11 May 2022 17:46:15 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:
>> These methods either set or clear a single bit in `firstChar`. >> The constant is an `int` so its complement is a 32 bit int. >> >> It could also be written as `~ (char) 0b1000000_0000000`. Then the 16 bit >> unsigned char would be complemented. >> Either way, the cast is needed to be explicit about the size of the constant. >> >> Another way to avoid the cast would be to define the bit positions as: >> >> `private static final char FIN_BIT = 0b10000000_00000000; >> ... etc. >> ` >> Then the code in the methods would not need the cast. >> >> >> if (value) { >> firstChar |= FIN_BIT; >> } else { >> firstChar &= ~FIN_BIT; >> } > > Ah! Good point. Maybe I should use a constant and get rid of the cast. 👍 I'd put `_MASK` in the name along with whatever name is used for the bits in the frame spec . ------------- PR: https://git.openjdk.java.net/jdk/pull/8656