Standard library / math/big
big.Int.Bits()
Expose the absolute magnitude as little-endian machine words sharing storage with the integer. Prefer Bytes for portable encoding; do not mutate raw storage casually. Expected stdout: '[42]\n'.
Formal Syntax & Structure
go syntaxgo
func (x *Int) Bits() []WordReturn Value
[]Word
Returns the result described above; see the example for the observed behavior.
Working Example
Example Snippetgo
package main
import ( "fmt" "math/big")
func main() { fmt.Println(big.NewInt(-42).Bits())}