Almost, I don’t think you need the “-1*” as that would make it a positive number.
[EDIT] although I would have probably expressed it as (pseudo code)
x= (a + (b*256)) if x > (2^16/2) x = (x - (2^16)) return x