]> git.proxmox.com Git - mirror_ovs.git/blobdiff - tests/test-hash.c
ofp-print: Abbreviate lists of fields in table features output.
[mirror_ovs.git] / tests / test-hash.c
index 83521567bea5fef34bbf4913b882d8bb4ba006f9..5d3f8ea43f6557f7af5b3a062e6e16c0d56e850e 100644 (file)
@@ -153,16 +153,15 @@ check_hash_bytes128(void (*hash)(const void *, size_t, uint32_t, ovs_u128 *),
         OVS_PACKED(struct offset_ovs_u128 {
             uint32_t a;
             ovs_u128 b;
-        }) in0_data;
-        ovs_u128 *in0, in1;
+        }) in0;
+        ovs_u128 in1;
         ovs_u128 out0, out1;
 
-        in0 = &in0_data.b;
-        set_bit128(in0, i, n_bits);
         set_bit128(&in1, i, n_bits);
-        hash(in0, sizeof(ovs_u128), 0, &out0);
+        in0.b = in1;
+        hash(&in0.b, sizeof(ovs_u128), 0, &out0);
         hash(&in1, sizeof(ovs_u128), 0, &out1);
-        if (!ovs_u128_equal(&out0, &out1)) {
+        if (!ovs_u128_equals(out0, out1)) {
             printf("%s hash not the same for non-64 aligned data "
                    "%016"PRIx64"%016"PRIx64" != %016"PRIx64"%016"PRIx64"\n",
                    name, out0.u64.lo, out0.u64.hi, out1.u64.lo, out1.u64.hi);
@@ -205,16 +204,17 @@ check_256byte_hash(void (*hash)(const void *, size_t, uint32_t, ovs_u128 *),
         OVS_PACKED(struct offset_ovs_u128 {
             uint32_t a;
             ovs_u128 b[16];
-        }) in0_data;
-        ovs_u128 *in0, in1[16];
+        }) in0;
+        ovs_u128 in1[16];
         ovs_u128 out0, out1;
 
-        in0 = in0_data.b;
-        set_bit128(in0, i, n_bits);
         set_bit128(in1, i, n_bits);
-        hash(in0, sizeof(ovs_u128) * 16, 0, &out0);
+        for (j = 0; j < 16; j++) {
+            in0.b[j] = in1[j];
+        }
+        hash(&in0.b, sizeof(ovs_u128) * 16, 0, &out0);
         hash(in1, sizeof(ovs_u128) * 16, 0, &out1);
-        if (!ovs_u128_equal(&out0, &out1)) {
+        if (!ovs_u128_equals(out0, out1)) {
             printf("%s hash not the same for non-64 aligned data "
                    "%016"PRIx64"%016"PRIx64" != %016"PRIx64"%016"PRIx64"\n",
                    name, out0.u64.lo, out0.u64.hi, out1.u64.lo, out1.u64.hi);