De-duplicates two byte arrays. If two byte arrays have the same contents but are different, this function helps to re-use the old one and discard the new copy. @param old The existing byte array. @param neww The new byte array we're trying to de-duplicate. @return old if neww is
(final byte[] old, final byte[] neww)
| 1084 | * contents, otherwise {@code neww}. |
| 1085 | */ |
| 1086 | public static byte[] deDup(final byte[] old, final byte[] neww) { |
| 1087 | return memcmp(old, neww) == 0 ? old : neww; |
| 1088 | } |
| 1089 | |
| 1090 | /** |
| 1091 | * Tests whether two byte arrays have the same contents. |