graph/internal/...: update for int64 IDs

This commit is contained in:
kortschak
2017-06-16 11:01:45 +09:30
committed by Dan Kortschak
parent b4e6656724
commit b47aa1446b
5 changed files with 79 additions and 6 deletions

View File

@@ -25,3 +25,12 @@ func same(a, b Nodes) bool {
func intsSame(a, b Ints) bool {
return reflect.ValueOf(a).Pointer() == reflect.ValueOf(b).Pointer()
}
// int64sSame determines whether two sets are backed by the same store. In the
// current implementation using hash maps it makes use of the fact that
// hash maps are passed as a pointer to a runtime Hmap struct. A map is
// not seen by the runtime as a pointer though, so we use reflect to get
// the maps' pointer values to compare.
func int64sSame(a, b Int64s) bool {
return reflect.ValueOf(a).Pointer() == reflect.ValueOf(b).Pointer()
}