2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-19 14:37:21 +00:00
Commit Graph

8 Commits

Author SHA1 Message Date
Ben Pfaff
1f26e79678 hash: Make functions for hashing a few words easier to use.
It's easier for the client to pass in data directly than it is for the
client to stuff it into an array.

These functions will have new users in upcoming commits.
2010-12-17 14:31:40 -08:00
Jesse Gross
91f227cad7 hash: Prevent warnings about strict aliasing rules.
Some versions of GCC complain about violations of strict aliasing
rules due to a cast between different pointer types.  This avoids
any aliasing by copying the value first.
2010-01-20 14:02:50 -05:00
Ben Pfaff
44528c5463 hash: Improve hash function for integers.
As previously defined, the following both returned the same value for
given values of 'basis':
	hash_int(0, hash_int(1, basis))
	hash_int(1, hash_int(0, basis))
because hash_int(0, basis) evaluated to basis and hash_int(1, basis)
evaluated to c + basis for some constant c.

This commit fixes the problem, by eliminating any simple linear
relationship between basis and the hash value.

We should write some tests for hash function quality.
2009-11-04 15:01:02 -08:00
Ben Pfaff
8e5421180d hash: Implement hash function for Boolean values.
This will be used by the configuration database, and it's generally useful
to have around.
2009-11-04 15:01:00 -08:00
Ben Pfaff
cce1d8bd8e hash: Implement hash function for "double" values.
This will be used by the configuration database, which can store real
numbers.
2009-11-04 15:00:30 -08:00
Ben Pfaff
0064467516 hash: Implement hash function for pointer values.
This will be used by an upcoming commit, and it's generally useful to
have around.
2009-11-04 15:00:28 -08:00
Ben Pfaff
a14bc59fb8 Update primary code license to Apache 2.0. 2009-06-15 15:11:30 -07:00
Ben Pfaff
064af42167 Import from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45. 2009-07-08 13:19:16 -07:00