github.com/primecitizens/pcz/std@v0.2.1/core/num/constraints.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  package num
     5  
     6  import "unsafe"
     7  
     8  // Uint is the type union of unsigned integers.
     9  type Uint interface {
    10  	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
    11  }
    12  
    13  // Int is the type union of signed integers.
    14  type Int interface {
    15  	~int | ~int8 | ~int16 | ~int32 | ~int64
    16  }
    17  
    18  // Integer is the type union of both signed and unsigned integers.
    19  type Integer interface {
    20  	Int | Uint
    21  }
    22  
    23  // Float is the type union of floating-point types.
    24  type Float interface {
    25  	~float32 | ~float64
    26  }
    27  
    28  // Real is the type union of all real number types.
    29  type Real interface {
    30  	Integer | Float
    31  }
    32  
    33  // Complex is the type union of all complex types.
    34  type Complex interface {
    35  	~complex64 | ~complex128
    36  }
    37  
    38  // Number is the type union of all numeric types.
    39  type Number interface {
    40  	Real | Complex
    41  }
    42  
    43  // Pointer represents all numeric types that can be a pointer value
    44  type Pointer interface {
    45  	~uintptr | ~unsafe.Pointer
    46  }