all: format code according to Go 1.19 rules

Go 1.19 started reformatting code in a way that makes it more obvious
how it will be rendered on pkg.go.dev. It gets it almost right, but not
entirely. Therefore, I had to modify some of the comments so that they
are formatted correctly.
This commit is contained in:
Ayke van Laethem
2022-08-03 16:24:47 +02:00
committed by Ayke
parent f936125658
commit c7a23183e8
114 changed files with 509 additions and 381 deletions
+2
View File
@@ -139,6 +139,7 @@ func chanMake(elementSize uintptr, bufSize uintptr) *channel {
// Return the number of entries in this chan, called from the len builtin.
// A nil chan is defined as having length 0.
//
//go:inline
func chanLen(c *channel) int {
if c == nil {
@@ -155,6 +156,7 @@ func chanLenUnsafePointer(p unsafe.Pointer) int {
// Return the capacity of this chan, called from the cap builtin.
// A nil chan is defined as having capacity 0.
//
//go:inline
func chanCap(c *channel) int {
if c == nil {
+4
View File
@@ -5,6 +5,7 @@ package runtime
// Update the C environment if cgo is loaded.
// Called from syscall.Setenv.
//
//go:linkname syscall_setenv_c syscall.setenv_c
func syscall_setenv_c(key string, val string) {
keydata := cstring(key)
@@ -16,6 +17,7 @@ func syscall_setenv_c(key string, val string) {
// Update the C environment if cgo is loaded.
// Called from syscall.Unsetenv.
//
//go:linkname syscall_unsetenv_c syscall.unsetenv_c
func syscall_unsetenv_c(key string) {
keydata := cstring(key)
@@ -34,9 +36,11 @@ func cstring(s string) []byte {
}
// int setenv(const char *name, const char *val, int replace);
//
//export setenv
func libc_setenv(name *byte, val *byte, replace int32) int32
// int unsetenv(const char *name);
//
//export unsetenv
func libc_unsetenv(name *byte) int32
+2 -1
View File
@@ -8,7 +8,7 @@ import "unsafe"
var inf = float64frombits(0x7FF0000000000000)
// isNaN reports whether f is an IEEE 754 ``not-a-number'' value.
// isNaN reports whether f is an IEEE 754 not-a-number value.
func isNaN(f float64) (is bool) {
// IEEE 754 says that only NaNs satisfy f != f.
return f != f
@@ -27,6 +27,7 @@ func isInf(f float64) bool {
// Abs returns the absolute value of x.
//
// Special cases are:
//
// Abs(±Inf) = +Inf
// Abs(NaN) = NaN
func abs(x float64) float64 {
+1
View File
@@ -259,6 +259,7 @@ func calculateHeapAddresses() {
// alloc tries to find some free space on the heap, possibly doing a garbage
// collection cycle if needed. If no space is free, it panics.
//
//go:noinline
func alloc(size uintptr, layout unsafe.Pointer) unsafe.Pointer {
if size == 0 {
+1
View File
@@ -18,6 +18,7 @@ var heapptr = heapStart
// Inlining alloc() speeds things up slightly but bloats the executable by 50%,
// see https://github.com/tinygo-org/tinygo/issues/2674. So don't.
//
//go:noinline
func alloc(size uintptr, layout unsafe.Pointer) unsafe.Pointer {
// TODO: this can be optimized by not casting between pointers and ints so
+6
View File
@@ -133,6 +133,7 @@ func hashmapShouldGrow(m *hashmap) bool {
// Return the number of entries in this hashmap, called from the len builtin.
// A nil hashmap is defined as having length 0.
//
//go:inline
func hashmapLen(m *hashmap) int {
if m == nil {
@@ -148,6 +149,7 @@ func hashmapLenUnsafePointer(p unsafe.Pointer) int {
}
// Set a specified key to a given value. Grow the map if necessary.
//
//go:nobounds
func hashmapSet(m *hashmap, key unsafe.Pointer, value unsafe.Pointer, hash uint32) {
if hashmapShouldGrow(m) {
@@ -251,6 +253,7 @@ func hashmapGrow(m *hashmap) {
}
// Get the value of a specified key, or zero the value if not found.
//
//go:nobounds
func hashmapGet(m *hashmap, key, value unsafe.Pointer, valueSize uintptr, hash uint32) bool {
if m == nil {
@@ -298,6 +301,7 @@ func hashmapGet(m *hashmap, key, value unsafe.Pointer, valueSize uintptr, hash u
// Delete a given key from the map. No-op when the key does not exist in the
// map.
//
//go:nobounds
func hashmapDelete(m *hashmap, key unsafe.Pointer, hash uint32) {
if m == nil {
@@ -338,6 +342,7 @@ func hashmapDelete(m *hashmap, key unsafe.Pointer, hash uint32) {
}
// Iterate over a hashmap.
//
//go:nobounds
func hashmapNext(m *hashmap, it *hashmapIterator, key, value unsafe.Pointer) bool {
if m == nil {
@@ -477,6 +482,7 @@ func hashmapStringDelete(m *hashmap, key string) {
// is identical to the Interface() method call, except it doesn't check whether
// a field is exported and thus allows circumventing the type system.
// The hash function needs it as it also needs to hash unexported struct fields.
//
//go:linkname valueInterfaceUnsafe reflect.valueInterfaceUnsafe
func valueInterfaceUnsafe(v reflect.Value) interface{}
+3 -3
View File
@@ -11,9 +11,9 @@ type State uint8
// Disable disables all interrupts and returns the previous interrupt state. It
// can be used in a critical section like this:
//
// state := interrupt.Disable()
// // critical section
// interrupt.Restore(state)
// state := interrupt.Disable()
// // critical section
// interrupt.Restore(state)
//
// Critical sections can be nested. Make sure to call Restore in the same order
// as you called Disable (this happens naturally with the pattern above).
+3 -3
View File
@@ -34,9 +34,9 @@ type State uintptr
// Disable disables all interrupts and returns the previous interrupt state. It
// can be used in a critical section like this:
//
// state := interrupt.Disable()
// // critical section
// interrupt.Restore(state)
// state := interrupt.Disable()
// // critical section
// interrupt.Restore(state)
//
// Critical sections can be nested. Make sure to call Restore in the same order
// as you called Disable (this happens naturally with the pattern above).
+6 -5
View File
@@ -16,11 +16,11 @@ import (
// The Interrupt.New(x, f) (x = [1..31]) attaches CPU interrupt to function f.
// Caller must map the selected interrupt using following sequence (for example using id 5):
//
// // map interrupt 5 to my XXXX module
// esp.INTERRUPT_CORE0.XXXX_INTERRUPT_PRO_MAP.Set( 5 )
// _ = Interrupt.New(5, func(interrupt.Interrupt) {
// ...
// }).Enable()
// // map interrupt 5 to my XXXX module
// esp.INTERRUPT_CORE0.XXXX_INTERRUPT_PRO_MAP.Set( 5 )
// _ = Interrupt.New(5, func(interrupt.Interrupt) {
// ...
// }).Enable()
func (i Interrupt) Enable() error {
if i.num < 1 && i.num > 31 {
return errors.New("interrupt for ESP32-C3 must be in range of 1 through 31")
@@ -49,6 +49,7 @@ func (i Interrupt) Enable() error {
// Adding pseudo function calls that is replaced by the compiler with the actual
// functions registered through interrupt.New.
//
//go:linkname callHandlers runtime/interrupt.callHandlers
func callHandlers(num int)
@@ -51,6 +51,7 @@ func handleInterrupt() {
// Pseudo function call that is replaced by the compiler with the actual
// functions registered through interrupt.New. If there are none, calls will be
// replaced with 'unreachablecalls will be replaced with 'unreachable'.
//
//go:linkname callHandlers runtime/interrupt.callHandlers
func callHandlers(num int)
@@ -93,9 +94,9 @@ type State uint8
// Disable disables all interrupts and returns the previous interrupt state. It
// can be used in a critical section like this:
//
// state := interrupt.Disable()
// // critical section
// interrupt.Restore(state)
// state := interrupt.Disable()
// // critical section
// interrupt.Restore(state)
//
// Critical sections can be nested. Make sure to call Restore in the same order
// as you called Disable (this happens naturally with the pattern above).
+3 -3
View File
@@ -9,9 +9,9 @@ type State uintptr
// Disable disables all interrupts and returns the previous interrupt state. It
// can be used in a critical section like this:
//
// state := interrupt.Disable()
// // critical section
// interrupt.Restore(state)
// state := interrupt.Disable()
// // critical section
// interrupt.Restore(state)
//
// Critical sections can be nested. Make sure to call Restore in the same order
// as you called Disable (this happens naturally with the pattern above).
@@ -11,9 +11,9 @@ type State uintptr
// Disable disables all interrupts and returns the previous interrupt state. It
// can be used in a critical section like this:
//
// state := interrupt.Disable()
// // critical section
// interrupt.Restore(state)
// state := interrupt.Disable()
// // critical section
// interrupt.Restore(state)
//
// Critical sections can be nested. Make sure to call Restore in the same order
// as you called Disable (this happens naturally with the pattern above).
+3 -3
View File
@@ -11,9 +11,9 @@ type State uintptr
// Disable disables all interrupts and returns the previous interrupt state. It
// can be used in a critical section like this:
//
// state := interrupt.Disable()
// // critical section
// interrupt.Restore(state)
// state := interrupt.Disable()
// // critical section
// interrupt.Restore(state)
//
// Critical sections can be nested. Make sure to call Restore in the same order
// as you called Disable (this happens naturally with the pattern above).
+1
View File
@@ -49,6 +49,7 @@ type segmentLoadCommand struct {
}
// MachO header of the currently running process.
//
//go:extern _mh_execute_header
var libc_mh_execute_header machHeader
+4
View File
@@ -7,11 +7,13 @@ import (
// trap is a compiler hint that this function cannot be executed. It is
// translated into either a trap instruction or a call to abort().
//
//export llvm.trap
func trap()
// Inline assembly stub. It is essentially C longjmp but modified a bit for the
// purposes of TinyGo. It restores the stack pointer and jumps to the given pc.
//
//export tinygo_longjmp
func tinygo_longjmp(frame *deferFrame)
@@ -61,6 +63,7 @@ func runtimePanic(msg string) {
// It gets passed in the stack-allocated defer frame and configures it.
// Note that the frame is not zeroed yet, so we need to initialize all values
// that will be used.
//
//go:inline
//go:nobounds
func setupDeferFrame(frame *deferFrame, jumpSP unsafe.Pointer) {
@@ -74,6 +77,7 @@ func setupDeferFrame(frame *deferFrame, jumpSP unsafe.Pointer) {
// Called right before the return instruction. It pops the defer frame from the
// linked list of defer frames. It also re-raises a panic if the goroutine is
// still panicking.
//
//go:inline
//go:nobounds
func destroyDeferFrame(frame *deferFrame) {
+2
View File
@@ -44,6 +44,7 @@ func memzero(ptr unsafe.Pointer, size uintptr)
// This intrinsic returns the current stack pointer.
// It is normally used together with llvm.stackrestore but also works to get the
// current stack pointer in a platform-independent way.
//
//export llvm.stacksave
func stacksave() unsafe.Pointer
@@ -70,6 +71,7 @@ func nanotime() int64 {
}
// Copied from the Go runtime source code.
//
//go:linkname os_sigpipe os.sigpipe
func os_sigpipe() {
runtimePanic("too many writes on closed pipe")
+1
View File
@@ -40,6 +40,7 @@ var _sidata [0]byte
var _edata [0]byte
// Entry point for Go. Initialize all packages and call main.main().
//
//export main
func main() {
// Initialize .data and .bss sections.
+1
View File
@@ -17,6 +17,7 @@ import (
// For details, see:
// https://community.arm.com/developer/ip-products/system/f/embedded-forum/3257/debugging-a-cortex-m0-hard-fault
// https://blog.feabhas.com/2013/02/developing-a-generic-hard-fault-handler-for-arm-cortex-m3cortex-m4/
//
//export handleHardFault
func handleHardFault(sp *interruptStack) {
print("fatal error: ")
@@ -18,6 +18,7 @@ const (
)
// See runtime_cortexm_hardfault.go
//
//go:export handleHardFault
func handleHardFault(sp *interruptStack) {
fault := GetFaultStatus()
+1
View File
@@ -11,6 +11,7 @@ import (
// This is the function called on startup right after the stack pointer has been
// set.
//
//export main
func main() {
// Disable the protection on the watchdog timer (needed when started from
+1
View File
@@ -12,6 +12,7 @@ import (
// This is the function called on startup after the flash (IROM/DROM) is
// initialized and the stack pointer has been set.
//
//export main
func main() {
// This initialization configures the following things:
+1
View File
@@ -33,6 +33,7 @@ func buffered() int {
// Write to the internal control bus (using I2C?).
// Signature found here:
// https://github.com/espressif/ESP8266_RTOS_SDK/blob/14171de0/components/esp8266/include/esp8266/rom_functions.h#L54
//
//export rom_i2c_writeReg
func rom_i2c_writeReg(block, host_id, reg_add, data uint8)
+7
View File
@@ -51,6 +51,7 @@ func preinit() {
}
// Entry point for Go. Initialize all packages and call main.main().
//
//export main
func main() {
preinit()
@@ -274,31 +275,37 @@ func getMainThreadHandle() uintptr {
func getArmSystemTick() int64
// nxExit exits the program to homebrew launcher
//
//export __nx_exit
func nxExit(code int, stackTop uintptr, exitFunction uintptr)
// Horizon System Calls
// svcSetHeapSize Set the process heap to a given size. It can both extend and shrink the heap.
// svc 0x01
//
//export svcSetHeapSize
func svcSetHeapSize(addr *uintptr, length uint64) uint64
// svcExitProcess Exits the current process.
// svc 0x07
//
//export svcExitProcess
func svcExitProcess(code int)
// svcSleepThread Sleeps the current thread for the specified amount of time.
// svc 0x0B
//
//export svcSleepThread
func svcSleepThread(nanos uint64)
// svcOutputDebugString Outputs debug text, if used during debugging.
// svc 0x27
//
//export svcOutputDebugString
func svcOutputDebugString(str *uint8, size uint64) uint64
// svcGetInfo Retrieves information about the system, or a certain kernel object.
// svc 0x29
//
//export svcGetInfo
func svcGetInfo(output *uint64, id0 uint32, handle uint32, id1 uint64) uint64
+1
View File
@@ -62,6 +62,7 @@ func nanosecondsToTicks(ns int64) timeUnit {
}
// number of ticks since start.
//
//go:linkname ticks runtime.ticks
func ticks() timeUnit {
// For some ways of capturing the time atomically, see this thread:
+9 -8
View File
@@ -6,14 +6,15 @@ package runtime
import "device/stm32"
/*
clock settings
+-------------+--------+
| HSE | 8mhz |
| SYSCLK | 168mhz |
| HCLK | 168mhz |
| APB2(PCLK2) | 84mhz |
| APB1(PCLK1) | 42mhz |
+-------------+--------+
clock settings
+-------------+--------+
| HSE | 8mhz |
| SYSCLK | 168mhz |
| HCLK | 168mhz |
| APB2(PCLK2) | 84mhz |
| APB1(PCLK1) | 42mhz |
+-------------+--------+
*/
const (
HSE_STARTUP_TIMEOUT = 0x0500
+9 -8
View File
@@ -6,14 +6,15 @@ package runtime
import "device/stm32"
/*
clock settings
+-------------+--------+
| HSE | 8mhz |
| SYSCLK | 180mhz |
| HCLK | 180mhz |
| APB2(PCLK2) | 90mhz |
| APB1(PCLK1) | 45mhz |
+-------------+--------+
clock settings
+-------------+--------+
| HSE | 8mhz |
| SYSCLK | 180mhz |
| HCLK | 180mhz |
| APB2(PCLK2) | 90mhz |
| APB1(PCLK1) | 45mhz |
+-------------+--------+
*/
const (
HSE_STARTUP_TIMEOUT = 0x0500
+9 -8
View File
@@ -9,14 +9,15 @@ import (
)
/*
clock settings
+-------------+--------+
| HSE | 8mhz |
| SYSCLK | 216mhz |
| HCLK | 216mhz |
| APB1(PCLK1) | 27mhz |
| APB2(PCLK2) | 108mhz |
+-------------+--------+
clock settings
+-------------+--------+
| HSE | 8mhz |
| SYSCLK | 216mhz |
| HCLK | 216mhz |
| APB1(PCLK1) | 27mhz |
| APB2(PCLK2) | 108mhz |
+-------------+--------+
*/
const (
HSE_STARTUP_TIMEOUT = 0x0500
+9 -8
View File
@@ -8,14 +8,15 @@ import (
)
/*
clock settings
+-------------+-----------+
| LSE | 32.768khz |
| SYSCLK | 80mhz |
| HCLK | 80mhz |
| APB1(PCLK1) | 80mhz |
| APB2(PCLK2) | 80mhz |
+-------------+-----------+
clock settings
+-------------+-----------+
| LSE | 32.768khz |
| SYSCLK | 80mhz |
| HCLK | 80mhz |
| APB1(PCLK1) | 80mhz |
| APB2(PCLK2) | 80mhz |
+-------------+-----------+
*/
const (
HSE_STARTUP_TIMEOUT = 0x0500
+9 -8
View File
@@ -8,14 +8,15 @@ import (
)
/*
clock settings
+-------------+-----------+
| LSE | 32.768khz |
| SYSCLK | 120mhz |
| HCLK | 120mhz |
| APB1(PCLK1) | 120mhz |
| APB2(PCLK2) | 120mhz |
+-------------+-----------+
clock settings
+-------------+-----------+
| LSE | 32.768khz |
| SYSCLK | 120mhz |
| HCLK | 120mhz |
| APB1(PCLK1) | 120mhz |
| APB2(PCLK2) | 120mhz |
+-------------+-----------+
*/
const (
HSE_STARTUP_TIMEOUT = 0x0500
+9 -8
View File
@@ -9,14 +9,15 @@ import (
)
/*
clock settings
+-------------+-----------+
| LSE | 32.768khz |
| SYSCLK | 110mhz |
| HCLK | 110mhz |
| APB1(PCLK1) | 110mhz |
| APB2(PCLK2) | 110mhz |
+-------------+-----------+
clock settings
+-------------+-----------+
| LSE | 32.768khz |
| SYSCLK | 110mhz |
| HCLK | 110mhz |
| APB1(PCLK1) | 110mhz |
| APB2(PCLK2) | 110mhz |
+-------------+-----------+
*/
const (
HSE_STARTUP_TIMEOUT = 0x0500
+1
View File
@@ -19,6 +19,7 @@ func fd_write(id uint32, iovs *__wasi_iovec_t, iovs_len uint, nwritten *uint) (e
// See:
// https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#-proc_exitrval-exitcode
//
//go:wasm-module wasi_snapshot_preview1
//export proc_exit
func proc_exit(exitcode uint32)
+3
View File
@@ -18,6 +18,7 @@ func usleep(usec uint) int
// Note: off_t is defined as int64 because:
// - musl (used on Linux) always defines it as int64
// - darwin is practically always 64-bit anyway
//
//export mmap
func mmap(addr unsafe.Pointer, length uintptr, prot, flags, fd int, offset int64) unsafe.Pointer
@@ -66,6 +67,7 @@ type timespec struct {
var stackTop uintptr
// Entry point for Go. Initialize all packages and call main.main().
//
//export main
func main(argc int32, argv *unsafe.Pointer) int {
preinit()
@@ -113,6 +115,7 @@ func os_runtime_args() []string {
}
// Must be a separate function to get the correct stack pointer.
//
//go:noinline
func runMain() {
run()
+1
View File
@@ -44,6 +44,7 @@ func nanosecondsToTicks(ns int64) timeUnit {
// This function is called by the scheduler.
// Schedule a call to runtime.scheduler, do not actually sleep.
//
//export runtime.sleepTicks
func sleepTicks(d timeUnit)
+2 -1
View File
@@ -10,6 +10,7 @@ import (
type timeUnit int64
// libc constructors
//
//export __wasm_call_ctors
func __wasm_call_ctors()
@@ -24,7 +25,7 @@ func _start() {
// Read the command line arguments from WASI.
// For example, they can be passed to a program with wasmtime like this:
//
// wasmtime ./program.wasm arg1 arg2
// wasmtime ./program.wasm arg1 arg2
func init() {
__wasm_call_ctors()
}
+2
View File
@@ -18,6 +18,7 @@ func _VirtualAlloc(lpAddress unsafe.Pointer, dwSize uintptr, flAllocationType, f
func _QueryUnbiasedInterruptTime(UnbiasedTime *uint64) bool
// The parameter is really a LPFILETIME, but *uint64 should be compatible.
//
//export GetSystemTimeAsFileTime
func _GetSystemTimeAsFileTime(lpSystemTimeAsFileTime *uint64)
@@ -56,6 +57,7 @@ func mainCRTStartup() int {
}
// Must be a separate function to get the correct stack pointer.
//
//go:noinline
func runMain() {
run()
+3 -1
View File
@@ -54,7 +54,8 @@ func scheduleLogChan(msg string, ch *channel, t *task.Task) {
// not exited (so deferred calls won't run). This can happen for example in code
// like this, that blocks forever:
//
// select{}
// select{}
//
//go:noinline
func deadlock() {
// call yield without requesting a wakeup
@@ -65,6 +66,7 @@ func deadlock() {
// Goexit terminates the currently running goroutine. No other goroutines are affected.
//
// Unlike the main Go implementation, no deffered calls will be run.
//
//go:inline
func Goexit() {
// its really just a deadlock
+1
View File
@@ -6,6 +6,7 @@ package runtime
import "internal/task"
// Pause the current task for a given time.
//
//go:linkname sleep time.Sleep
func sleep(duration int64) {
if duration <= 0 {
+3
View File
@@ -18,6 +18,7 @@ type stringIterator struct {
}
// Return true iff the strings match.
//
//go:nobounds
func stringEqual(x, y string) bool {
if len(x) != len(y) {
@@ -32,6 +33,7 @@ func stringEqual(x, y string) bool {
}
// Return true iff x < y.
//
//go:nobounds
func stringLess(x, y string) bool {
l := len(x)
@@ -181,6 +183,7 @@ func encodeUTF8(x rune) ([4]byte, uintptr) {
}
// Decode a single UTF-8 character from a string.
//
//go:nobounds
func decodeUTF8(s string, index uintptr) (rune, uintptr) {
remaining := uintptr(len(s)) - index // must be >= 1 before calling this function
+4 -4
View File
@@ -50,10 +50,10 @@ func nanosecondsToTicks(ns int64) timeUnit {
return timeUnit(ns / 1000)
}
// cyclesPerMilli-1 is used for the systick reset value
// the systick current value will be decremented on every clock cycle
// an interrupt is generated when the current value reaches 0
// a value of freq/1000 generates a tick (irq) every millisecond (1/1000 s)
// cyclesPerMilli-1 is used for the systick reset value.
// The systick current value will be decremented on every clock cycle.
// An interrupt is generated when the current value reaches 0.
// A value of freq/1000 generates a tick (irq) every millisecond (1/1000 s).
var cyclesPerMilli = machine.CPUFrequency() / 1000
// number of systick irqs (milliseconds) since boot
+2 -2
View File
@@ -28,7 +28,7 @@ type BitRegister struct {
// Get returns the of the mapped register bit. It is the volatile equivalent of:
//
// *r.Reg
// *r.Reg
//
//go:inline
func (r *BitRegister) Get() bool {
@@ -37,7 +37,7 @@ func (r *BitRegister) Get() bool {
// Set sets the mapped register bit. It is the volatile equivalent of:
//
// *r.Reg = 1
// *r.Reg = 1
//
//go:inline
func (r *BitRegister) Set(v bool) {
+24 -24
View File
@@ -11,7 +11,7 @@ type Register8 struct {
// Get returns the value in the register. It is the volatile equivalent of:
//
// *r.Reg
// *r.Reg
//
//go:inline
func (r *Register8) Get() uint8 {
@@ -20,7 +20,7 @@ func (r *Register8) Get() uint8 {
// Set updates the register value. It is the volatile equivalent of:
//
// *r.Reg = value
// *r.Reg = value
//
//go:inline
func (r *Register8) Set(value uint8) {
@@ -30,7 +30,7 @@ func (r *Register8) Set(value uint8) {
// SetBits reads the register, sets the given bits, and writes it back. It is
// the volatile equivalent of:
//
// r.Reg |= value
// r.Reg |= value
//
//go:inline
func (r *Register8) SetBits(value uint8) {
@@ -40,7 +40,7 @@ func (r *Register8) SetBits(value uint8) {
// ClearBits reads the register, clears the given bits, and writes it back. It
// is the volatile equivalent of:
//
// r.Reg &^= value
// r.Reg &^= value
//
//go:inline
func (r *Register8) ClearBits(value uint8) {
@@ -50,7 +50,7 @@ func (r *Register8) ClearBits(value uint8) {
// HasBits reads the register and then checks to see if the passed bits are set. It
// is the volatile equivalent of:
//
// (*r.Reg & value) > 0
// (*r.Reg & value) > 0
//
//go:inline
func (r *Register8) HasBits(value uint8) bool {
@@ -60,7 +60,7 @@ func (r *Register8) HasBits(value uint8) bool {
// ReplaceBits is a helper to simplify setting multiple bits high and/or low at
// once. It is the volatile equivalent of:
//
// r.Reg = (r.Reg & ^(mask << pos)) | value << pos
// r.Reg = (r.Reg & ^(mask << pos)) | value << pos
//
// go:inline
func (r *Register8) ReplaceBits(value uint8, mask uint8, pos uint8) {
@@ -73,7 +73,7 @@ type Register16 struct {
// Get returns the value in the register. It is the volatile equivalent of:
//
// *r.Reg
// *r.Reg
//
//go:inline
func (r *Register16) Get() uint16 {
@@ -82,7 +82,7 @@ func (r *Register16) Get() uint16 {
// Set updates the register value. It is the volatile equivalent of:
//
// *r.Reg = value
// *r.Reg = value
//
//go:inline
func (r *Register16) Set(value uint16) {
@@ -92,7 +92,7 @@ func (r *Register16) Set(value uint16) {
// SetBits reads the register, sets the given bits, and writes it back. It is
// the volatile equivalent of:
//
// r.Reg |= value
// r.Reg |= value
//
//go:inline
func (r *Register16) SetBits(value uint16) {
@@ -102,7 +102,7 @@ func (r *Register16) SetBits(value uint16) {
// ClearBits reads the register, clears the given bits, and writes it back. It
// is the volatile equivalent of:
//
// r.Reg &^= value
// r.Reg &^= value
//
//go:inline
func (r *Register16) ClearBits(value uint16) {
@@ -112,7 +112,7 @@ func (r *Register16) ClearBits(value uint16) {
// HasBits reads the register and then checks to see if the passed bits are set. It
// is the volatile equivalent of:
//
// (*r.Reg & value) > 0
// (*r.Reg & value) > 0
//
//go:inline
func (r *Register16) HasBits(value uint16) bool {
@@ -122,7 +122,7 @@ func (r *Register16) HasBits(value uint16) bool {
// ReplaceBits is a helper to simplify setting multiple bits high and/or low at
// once. It is the volatile equivalent of:
//
// r.Reg = (r.Reg & ^(mask << pos)) | value << pos
// r.Reg = (r.Reg & ^(mask << pos)) | value << pos
//
// go:inline
func (r *Register16) ReplaceBits(value uint16, mask uint16, pos uint8) {
@@ -135,7 +135,7 @@ type Register32 struct {
// Get returns the value in the register. It is the volatile equivalent of:
//
// *r.Reg
// *r.Reg
//
//go:inline
func (r *Register32) Get() uint32 {
@@ -144,7 +144,7 @@ func (r *Register32) Get() uint32 {
// Set updates the register value. It is the volatile equivalent of:
//
// *r.Reg = value
// *r.Reg = value
//
//go:inline
func (r *Register32) Set(value uint32) {
@@ -154,7 +154,7 @@ func (r *Register32) Set(value uint32) {
// SetBits reads the register, sets the given bits, and writes it back. It is
// the volatile equivalent of:
//
// r.Reg |= value
// r.Reg |= value
//
//go:inline
func (r *Register32) SetBits(value uint32) {
@@ -164,7 +164,7 @@ func (r *Register32) SetBits(value uint32) {
// ClearBits reads the register, clears the given bits, and writes it back. It
// is the volatile equivalent of:
//
// r.Reg &^= value
// r.Reg &^= value
//
//go:inline
func (r *Register32) ClearBits(value uint32) {
@@ -174,7 +174,7 @@ func (r *Register32) ClearBits(value uint32) {
// HasBits reads the register and then checks to see if the passed bits are set. It
// is the volatile equivalent of:
//
// (*r.Reg & value) > 0
// (*r.Reg & value) > 0
//
//go:inline
func (r *Register32) HasBits(value uint32) bool {
@@ -184,7 +184,7 @@ func (r *Register32) HasBits(value uint32) bool {
// ReplaceBits is a helper to simplify setting multiple bits high and/or low at
// once. It is the volatile equivalent of:
//
// r.Reg = (r.Reg & ^(mask << pos)) | value << pos
// r.Reg = (r.Reg & ^(mask << pos)) | value << pos
//
// go:inline
func (r *Register32) ReplaceBits(value uint32, mask uint32, pos uint8) {
@@ -197,7 +197,7 @@ type Register64 struct {
// Get returns the value in the register. It is the volatile equivalent of:
//
// *r.Reg
// *r.Reg
//
//go:inline
func (r *Register64) Get() uint64 {
@@ -206,7 +206,7 @@ func (r *Register64) Get() uint64 {
// Set updates the register value. It is the volatile equivalent of:
//
// *r.Reg = value
// *r.Reg = value
//
//go:inline
func (r *Register64) Set(value uint64) {
@@ -216,7 +216,7 @@ func (r *Register64) Set(value uint64) {
// SetBits reads the register, sets the given bits, and writes it back. It is
// the volatile equivalent of:
//
// r.Reg |= value
// r.Reg |= value
//
//go:inline
func (r *Register64) SetBits(value uint64) {
@@ -226,7 +226,7 @@ func (r *Register64) SetBits(value uint64) {
// ClearBits reads the register, clears the given bits, and writes it back. It
// is the volatile equivalent of:
//
// r.Reg &^= value
// r.Reg &^= value
//
//go:inline
func (r *Register64) ClearBits(value uint64) {
@@ -236,7 +236,7 @@ func (r *Register64) ClearBits(value uint64) {
// HasBits reads the register and then checks to see if the passed bits are set. It
// is the volatile equivalent of:
//
// (*r.Reg & value) > 0
// (*r.Reg & value) > 0
//
//go:inline
func (r *Register64) HasBits(value uint64) bool {
@@ -246,7 +246,7 @@ func (r *Register64) HasBits(value uint64) bool {
// ReplaceBits is a helper to simplify setting multiple bits high and/or low at
// once. It is the volatile equivalent of:
//
// r.Reg = (r.Reg & ^(mask << pos)) | value << pos
// r.Reg = (r.Reg & ^(mask << pos)) | value << pos
//
// go:inline
func (r *Register64) ReplaceBits(value uint64, mask uint64, pos uint8) {