bits.Len32() Function in Golang with Examples Last Updated : 19 Apr, 2020 Comments Improve Suggest changes Like Article Like Report Go language provides inbuilt support for bits to implement bit counting and manipulation functions for the predeclared unsigned integer types with the help of bits package. This package provides Len32() function which is used to find the minimum number of bits required to represent a and the result is 0 for a == 0. To access Len32() function you need to add a math/bits package in your program with the help of the import keyword. Syntax: func Len(a uint32) (n int) Parameters: This function takes one parameter of uint32 type, i.e., a. Return Value: This function returns the minimum number of bits required to represent a. Example 1: C // Golang program to illustrate bits.Len32() Function package main import ( "fmt" "math/bits" ) // Main function func main() { // Using Len32() function a := bits.Len32(4) fmt.Printf("The minimum number of bits "+ "required to represent %d: %d", 4, a) } Output: The minimum number of bits required to represent 4: 3 Example 2: C // Golang program to illustrate bits.Len32() Function package main import ( "fmt" "math/bits" ) // Main function func main() { // Using Len32() function a1 := bits.Len32(5) fmt.Printf("Len32(%032b) = %d\n", 5, a1) a2 := bits.Len32(12) fmt.Printf("Len32(%032b) = %d\n", 12, a2) } Output: Len32(00000000000000000000000000000101) = 3 Len32(00000000000000000000000000001100) = 4 Comment More infoAdvertise with us Next Article bits.Len32() Function in Golang with Examples K Kirti_Mangal Follow Improve Article Tags : Go Language Golang-bits Similar Reads bits.Len() Function in Golang with Examples Go language provides inbuilt support for bits to implement bit counting and manipulation functions for the predeclared unsigned integer types with the help of bits package. This package provides Len() function which is used to find the minimum number of bits required to represent a and the result is 2 min read bits.Len8() Function in Golang with Examples Go language provides inbuilt support for bits to implement bit counting and manipulation functions for the predeclared unsigned integer types with the help of bits package. This package provides Len8() function which is used to find the minimum number of bits required to represent a and the result i 2 min read bits.Len64() Function in Golang with Examples Go language provides inbuilt support for bits to implement bit counting and manipulation functions for the predeclared unsigned integer types with the help of bits package. This package provides Len64() function which is used to find the minimum number of bits required to represent a and the result 2 min read bits.Len16() Function in Golang with Examples Go language provides inbuilt support for bits to implement bit counting and manipulation functions for the predeclared unsigned integer types with the help of bits package. This package provides Len16() function which is used to find the minimum number of bits required to represent a and the result 2 min read bits.Mul32() Function in Golang with Examples bits.Mul32() Function in Golang is used to find the 64-bit product of x and y. The execution time of this function does not depend on the inputs. To access this function, one needs to imports the math/bits package in the program. Syntax: func Mul32(x, y uint32) (hi, lo uint32) Parameters: This funct 2 min read Like