Previous 16 bit mask would do the wrong thing if the keycode was > 65536, which is not often true but is certainly a valid value (and seen on some platforms)