go123: lab.nexedi.com/kirr/go123/xmath Index | Files

package xmath

import "lab.nexedi.com/kirr/go123/xmath"

Package xmath provides addons to std math package.


Package Files


func CeilLog2 Uses

func CeilLog2(x uint64) int

CeilLog2 returns minimal i: 2^i >= x.

func CeilPow2 Uses

func CeilPow2(x uint64) uint64

CeilPow2 returns minimal y >= x, such that y = 2^i.

func FloorLog2 Uses

func FloorLog2(x uint64) int

FloorLog2 returns maximal i: 2^i <= x.

x=0 gives -> -1.

Package xmath imports 1 packages (graph) and is imported by 4 packages. Updated 2020-08-04. Refresh now. Tools for package owners.