mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-11 21:49:13 +00:00
add compiler hints to reduce number of slice bounds checks (#158)
* add compiler hints to reduce number of slice bounds checks * panic on assert instead of returning error for code coverage
This commit is contained in:
8
stmt.go
8
stmt.go
@@ -639,6 +639,14 @@ func (s *Stmt) Columns(dest []any) error {
|
||||
}
|
||||
|
||||
types := util.View(s.c.mod, typePtr, count)
|
||||
|
||||
// hint to the compiler that
|
||||
// it can omit bounds check
|
||||
// accessing types[i] below.
|
||||
if len(types) != len(dest) {
|
||||
panic(util.AssertErr())
|
||||
}
|
||||
|
||||
for i := range dest {
|
||||
switch types[i] {
|
||||
case byte(INTEGER):
|
||||
|
||||
Reference in New Issue
Block a user