Yi Tseng 09347c11b5 Handle huge egress port number in PreReplicaCodec
When using logical port for replica such as SDN CPU port (0xfffffffd), the
PreReplicaCodec will throw an ArithmeticException since this value is too
big for an signed 32-bit integer.

In that example, we need to convert the value to -3

According to the protobuf document[1]:
"In Java, unsigned 32-bit and 64-bit integers are represented using their
signed counterparts, with the top bit simply being stored in the sign bit."

[1]: https://developers.google.com/protocol-buffers/docs/proto#scalar

Change-Id: Ie3bda828d499b7d26d7b790f9ed76bb687243e57
2022-02-04 08:14:27 +00:00
..
2019-05-07 18:36:46 -07:00