Standard library / math/big
big.Int.Bit()
Read bit i, with index zero at the least significant bit. Negative indices panic. Expected stdout: '1 0\n'.
Formal Syntax & Structure
go syntaxgo
func (x *Int) Bit(i int) uintParameters & Attributes
| Name | Type | Description |
|---|---|---|
| i | int | Zero-based bit index. |
Return Value
uint
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(10).Bit(1), big.NewInt(10).Bit(0))}