mirror of https://github.com/periph/devices
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
468 B
Go
23 lines
468 B
Go
// Copyright 2026 The Periph Authors. All rights reserved.
|
|
// Use of this source code is governed under the Apache License, Version 2.0
|
|
// that can be found in the LICENSE file.
|
|
|
|
package sen6x
|
|
|
|
import (
|
|
"bytes"
|
|
)
|
|
|
|
// clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte.
|
|
func clen(n []byte) int {
|
|
if i := bytes.IndexByte(n, 0); i != -1 {
|
|
return i
|
|
}
|
|
|
|
return len(n)
|
|
}
|
|
|
|
func ptr[T uint16 | int16 | float32](n T) *T {
|
|
return &n
|
|
}
|