|in| should be const.

You assume USHRT_MAX is 65535.