from __future__ import annotations def is_newer(a: int, b: int) -> bool: """Return True if 16-bit sequence number a is newer than b (wrap-aware). Uses half-range window on unsigned 16-bit arithmetic. """ return ((a - b) & 0xFFFF) < 0x8000