ix

package
v0.0.0-...-265a42a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 2 Imported by: 11

Documentation

Overview

Copyright 2020...2021 Adam Lavrik <lavrik.adam@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2020...2021 Adam Lavrik <lavrik.adam@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2020...2021 Adam Lavrik <lavrik.adam@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	Size    = unsafe.Sizeof(T(0))
	BitSize = Size << 3
	Maximal = T(^UT(0) >> 1)
	Minimal = ^Maximal
)

Variables

This section is empty.

Functions

func DivMod

func DivMod(dividend, divisor T) (T, T)

func Is2Power

func Is2Power(value T) bool

func IsOdd

func IsOdd(value T) bool

func MinMax

func MinMax(value_0, value_1 T) (T, T)

func MinMaxSlice

func MinMaxSlice(values []T) (T, T)

func MinMaxSliceChecked

func MinMaxSliceChecked(values []T) (T, T, bool)

func MinMaxs

func MinMaxs(value T, values ...T) (T, T)

func Pow

func Pow(base int, exponent uint) int

Pow raises `base` to `exponent` power. Fast binary algorithm is used. Pow(0, 0) == 1

Types

type T

type T = int

func Abs

func Abs(value T) T

func Copysign

func Copysign(target, source T) T

func Fibonacci

func Fibonacci(index int) T

Fibonacci(index) returns Fibonacci sequence member with corresponding index: - Fibonacci(0) == 0 - Fibonacci(1) == Fibonacci(2) == 1 - Fibonacci(3) == 2 - Fibonacci(4) == 3 ... Negative indexes produce results, extended for negative values: - Fibonacci(-1) == 1 - Fibonacci(-2) == -1 - Fibonacci(-3) == 2 - Fibonacci(-4) == -3 ... Result is calculated via matrix ((1, 1), (1, 0)) fast raising to `index` power.

func Max

func Max(value_0, value_1 T) T

func MaxSlice

func MaxSlice(values []T) T

func MaxSliceChecked

func MaxSliceChecked(values []T) (T, bool)

func Maxs

func Maxs(value T, values ...T) T

func Min

func Min(value_0, value_1 T) T

func MinSlice

func MinSlice(values []T) T

func MinSliceChecked

func MinSliceChecked(values []T) (T, bool)

func Mins

func Mins(value T, values ...T) T

func Sign

func Sign(value T) T

func SignBit

func SignBit(value T) T

type UT

type UT = uint

func Absu

func Absu(value T) UT

func GCD

func GCD(value_0, value_1 T) UT

func LCM

func LCM(value_0, value_1 T) UT

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL