File: rounding.go

package info (click to toggle)
golang-github-go-crypt-crypt 0.4.7-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 516 kB
  • sloc: makefile: 4
file content (11 lines) | stat: -rw-r--r-- 386 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
package math

// RoundDownToNearestMultiple returns the nearest multiple of value.
func RoundDownToNearestMultiple(value, multiple int) int {
	return (value / multiple) * multiple
}

// Uint32RoundDownToNearestMultiple returns the nearest multiple of value (uint32 version).
func Uint32RoundDownToNearestMultiple(value, multiple uint32) uint32 {
	return (value / multiple) * multiple
}