Skip to content

Instantly share code, notes, and snippets.

@xubiod
Created August 12, 2022 18:42
Show Gist options
  • Select an option

  • Save xubiod/3ca4033d91d7758f2965656a64eb6465 to your computer and use it in GitHub Desktop.

Select an option

Save xubiod/3ca4033d91d7758f2965656a64eb6465 to your computer and use it in GitHub Desktop.
hahaha purposefully written to extend sloc
package main
// Any signed int, ranging 8 bits to 64
type AnySInt interface {
int |
int8 |
int16 |
int32 |
int64
}
// Any uint, ranging 8 bits to 64
type AnyUInt interface {
uint |
uint8 |
uint16 |
uint32 |
uint64
}
// Any int type, signed or unsigned
type AnyInt interface {
AnySInt |
AnyUInt
}
// Any float, can be float32 or float64
type AnyFloat interface {
float32 |
float64
}
// Any complex number, can be complex64 or complex128
type AnyComplex interface {
complex64 |
complex128
}
// Any number type built into go w/o complex numbers
type AnyNumber interface {
AnyInt |
AnyFloat
}
// Any number type build into go w/ complex numbers
type ReallyAnyNumber interface {
AnyNumber |
AnyComplex
}
// Any number type that uses 128 bits
type Only128Bits interface {
complex128
}
// Any number type that uses 64 bits
type Only64Bits interface {
int64 |
uint64 |
float64 |
complex64
}
// Any number type that uses 32 bits
type Only32Bits interface {
int32 |
uint32 |
float32
}
// Any number type that uses 16 bits
type Only16Bits interface {
int16 |
uint16
}
// Any number type that uses 8 bits
type Only8Bits interface {
int8 |
uint8
}
// Any number with less than 16 bits
type OnlyLessThan16Bits interface {
Only8Bits
}
// Any number with less than 32 bits
type OnlyLessThan32Bits interface {
OnlyLessThan16Bits |
Only16Bits
}
// Any number with less than or equal to 16 bits
type OnlyLessThanOrEqualTo16Bits interface {
OnlyLessThan32Bits
}
// Any number with less than 64 bits
type OnlyLessThan64Bits interface {
OnlyLessThan32Bits |
Only32Bits
}
// Any number with less than or equal to 32 bits
type OnlyLessThanOrEqualTo32Bits interface {
OnlyLessThan64Bits
}
// Any number with less than 128 bits
type OnlyLessThan128Bits interface {
OnlyLessThan64Bits |
Only64Bits
}
// Any number with less than or equal to 64 bits
type OnlyLessThanOrEqualTo64Bits interface {
OnlyLessThan128Bits
}
// Any number with more than 64 bits
type OnlyMoreThan64Bits interface {
Only128Bits
}
// Any number with more than or equal 128 bits
type OnlyMoreThanOrEqualTo128Bits interface {
OnlyMoreThan64Bits
}
// Any number with more than 32 bits
type OnlyMoreThan32Bits interface {
Only64Bits |
OnlyMoreThan64Bits
}
// Any number with more than or equal 64 bits
type OnlyMoreThanOrEqualTo64Bits interface {
OnlyMoreThan32Bits
}
// Any number with more than 16 bits
type OnlyMoreThan16Bits interface {
Only32Bits |
OnlyMoreThan32Bits
}
// Any number with more than or equal 32 bits
type OnlyMoreThanOrEqualTo32Bits interface {
OnlyMoreThan16Bits
}
// Any number with more than 8 bits
type OnlyMoreThan8Bits interface {
Only16Bits |
OnlyMoreThan16Bits
}
// Any number with more than or equal 8 bits
type OnlyMoreThanOrEqualTo16Bits interface {
OnlyMoreThan8Bits
}
// Any number without 8 bits
type OnlyNot8Bits interface {
Only16Bits |
Only32Bits |
Only64Bits |
Only128Bits
}
// Any number without 16 bits
type OnlyNot16Bits interface {
Only8Bits |
Only32Bits |
Only64Bits |
Only128Bits
}
// Any number without 32 bits
type OnlyNot32Bits interface {
Only8Bits |
Only16Bits |
Only64Bits |
Only128Bits
}
// Any number without 64 bits
type OnlyNot64Bits interface {
Only8Bits |
Only16Bits |
Only32Bits |
Only128Bits
}
// Any number without 128 bits
type OnlyNot128Bits interface {
Only8Bits |
Only16Bits |
Only32Bits |
Only64Bits
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment