Skip to content

Commit 6540f59

Browse files
committed
godoc: Warn users that the dst bitmap must be zeroed before
The AVX2 loop will write the zeroes, but the fallback loop won't. If the number of rows isn't a multiple of 64, both implementation might be used in one call.
1 parent 552cd6d commit 6540f59

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

typeswitch.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package vectorcmp
22

33
// VectorEquals compares each entry in rows to search and enables the corresponding bit in dst if equal.
4+
// dst must be zeroed before this call.
45
// Prefer calling VectorEquals8/16/32/64 directly.
56
//
67
// for i, v := range rows {
@@ -24,6 +25,7 @@ func VectorEquals[T uint8 | uint16 | uint32 | uint64](dst []byte, search T, rows
2425
}
2526

2627
// VectorGreaterThan compares each entry in rows to search and enables the corresponding bit in dst if search > rows[i].
28+
// dst must be zeroed before this call.
2729
// Prefer calling VectorGreaterThan8/16/32/64 directly.
2830
//
2931
// for i, v := range rows {
@@ -47,6 +49,7 @@ func VectorGreaterThan[T uint8 | uint16 | uint32 | uint64](dst []byte, search T,
4749
}
4850

4951
// VectorLessThan compares each entry in rows to search and enables the corresponding bit in dst if search < rows[i].
52+
// dst must be zeroed before this call.
5053
// Prefer calling VectorLessThan8/16/32/64 directly.
5154
//
5255
// for i, v := range rows {
@@ -70,6 +73,7 @@ func VectorLessThan[T uint8 | uint16 | uint32 | uint64](dst []byte, search T, ro
7073
}
7174

7275
// VectorGreaterEquals compares each entry in rows to search and enables the corresponding bit in dst if search >= rows[i].
76+
// dst must be zeroed before this call.
7377
// Prefer calling VectorGreaterEquals8/16/32/64 directly.
7478
//
7579
// for i, v := range rows {
@@ -93,6 +97,7 @@ func VectorGreaterEquals[T uint8 | uint16 | uint32 | uint64](dst []byte, search
9397
}
9498

9599
// VectorLesserEquals compares each entry in rows to search and enables the corresponding bit in dst if search <= rows[i].
100+
// dst must be zeroed before this call.
96101
// Prefer calling VectorLesserEquals8/16/32/64 directly.
97102
//
98103
// for i, v := range rows {

0 commit comments

Comments
 (0)