Skip to content

Commit

Permalink
Update indentation style
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Nov 11, 2024
1 parent 7ccd7bb commit 619a19b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 39 deletions.
8 changes: 4 additions & 4 deletions src/core/hypotenuse-core.scala
Original file line number Diff line number Diff line change
Expand Up @@ -376,28 +376,28 @@ inline def log1p(f64: into F64): F64 = F64(math.log1p(f64.double))
extension [LeftType](inline left: LeftType)
@targetName("lt")
inline infix def < [RightType](inline right: RightType)
(using inline commensurable: LeftType is Commensurable by RightType)
(using inline commensurable: LeftType is Commensurable by RightType)
: Boolean =

commensurable.compare(left, right, true, false)

@targetName("lte")
inline infix def <= [RightType](inline right: RightType)
(using inline commensurable: LeftType is Commensurable by RightType)
(using inline commensurable: LeftType is Commensurable by RightType)
: Boolean =

commensurable.compare(left, right, false, false)

@targetName("gt")
inline infix def > [RightType](inline right: RightType)
(using inline commensurable: LeftType is Commensurable by RightType)
(using inline commensurable: LeftType is Commensurable by RightType)
: Boolean =

commensurable.compare(left, right, true, true)

@targetName("gte")
inline infix def >= [RightType](inline right: RightType)
(using inline commensurable: LeftType is Commensurable by RightType)
(using inline commensurable: LeftType is Commensurable by RightType)
: Boolean =

commensurable.compare(left, right, false, true)
Expand Down
31 changes: 17 additions & 14 deletions src/core/hypotenuse.Commensurable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,41 @@ object Commensurable:
type Operand = OperandType

inline def compare
(inline left: Boolean,
inline right: OperandType,
inline strict: Boolean,
inline greaterThan: Boolean)
(inline left: Boolean,
inline right: OperandType,
inline strict: Boolean,
inline greaterThan: Boolean)
: Boolean =

${Hypotenuse2.commensurable('left, 'right, 'strict, 'greaterThan)}

given ByteSize is Orderable as orderable:
inline def compare
(inline left: ByteSize, inline right: ByteSize, inline strict: Boolean, inline greater: Boolean)
(inline left: ByteSize,
inline right: ByteSize,
inline strict: Boolean,
inline greater: Boolean)
: Boolean =

!strict && left.long == right.long || (left.long < right.long) ^ greater

inline given Countback is Orderable:
inline def compare
(inline left: Countback,
inline right: Countback,
inline strict: Boolean,
inline greater: Boolean)
(inline left: Countback,
inline right: Countback,
inline strict: Boolean,
inline greater: Boolean)
: Boolean =

inline if greater then inline if strict then left.gt(right) else left.ge(right)
else inline if strict then left.lt(right) else left.le(right)

inline given Ordinal is Orderable:
inline def compare
(inline left: Ordinal,
inline right: Ordinal,
inline strict: Boolean,
inline greater: Boolean)
(inline left: Ordinal,
inline right: Ordinal,
inline strict: Boolean,
inline greater: Boolean)
: Boolean =

inline if greater then inline if strict then left.gt(right) else left.ge(right)
Expand All @@ -71,5 +74,5 @@ trait Commensurable:
type Operand

inline def compare
(inline left: Self, inline right: Operand, inline strict: Boolean, inline greaterThan: Boolean)
(inline left: Self, inline right: Operand, inline strict: Boolean, inline greaterThan: Boolean)
: Boolean
23 changes: 11 additions & 12 deletions src/core/hypotenuse.Hypotenuse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ object Hypotenuse:
inline given F64 is Orderable as orderable:

inline def compare
(inline left: F64, inline right: F64, inline strict: Boolean, inline greater: Boolean)
(inline left: F64, inline right: F64, inline strict: Boolean, inline greater: Boolean)
: Boolean =

inline if greater
Expand All @@ -83,7 +83,7 @@ object Hypotenuse:
type Operand = Int

inline def compare
(inline left: F64, inline right: Int, inline strict: Boolean, inline greaterThan: Boolean)
(inline left: F64, inline right: Int, inline strict: Boolean, inline greaterThan: Boolean)
: Boolean =

inline if greaterThan
Expand Down Expand Up @@ -142,7 +142,7 @@ object Hypotenuse:
inline given F32 is Orderable as orderable:

inline def compare
(inline left: F32, inline right: F32, inline strict: Boolean, inline greaterThan: Boolean)
(inline left: F32, inline right: F32, inline strict: Boolean, inline greaterThan: Boolean)
: Boolean =

inline if greaterThan
Expand Down Expand Up @@ -190,7 +190,7 @@ object Hypotenuse:
inline given U64 is Orderable as orderable:

inline def compare
(inline left: U64, inline right: U64, inline strict: Boolean, inline greaterThan: Boolean)
(inline left: U64, inline right: U64, inline strict: Boolean, inline greaterThan: Boolean)
: Boolean =

inline if greaterThan then
Expand All @@ -214,7 +214,7 @@ object Hypotenuse:
inline given S64 is Orderable as orderable:

inline def compare
(inline left: S64, inline right: S64, inline strict: Boolean, inline greaterThan: Boolean)
(inline left: S64, inline right: S64, inline strict: Boolean, inline greaterThan: Boolean)
: Boolean =

inline if greaterThan
Expand All @@ -234,7 +234,7 @@ object Hypotenuse:

inline given U32 is Orderable as orderable:
inline def compare
(inline left: U32, inline right: U32, inline strict: Boolean, inline greaterThan: Boolean)
(inline left: U32, inline right: U32, inline strict: Boolean, inline greaterThan: Boolean)
: Boolean =

inline if greaterThan then
Expand All @@ -258,7 +258,7 @@ object Hypotenuse:
inline given S32 is Orderable as orderable:

inline def compare
(inline left: S32, inline right: S32, inline strict: Boolean, inline greaterThan: Boolean)
(inline left: S32, inline right: S32, inline strict: Boolean, inline greaterThan: Boolean)
: Boolean =

inline if greaterThan
Expand All @@ -278,7 +278,7 @@ object Hypotenuse:
inline given U16 is Orderable as orderable:

inline def compare
(inline left: U16, inline right: U16, inline strict: Boolean, inline greaterThan: Boolean)
(inline left: U16, inline right: U16, inline strict: Boolean, inline greaterThan: Boolean)
: Boolean =

val left2 = JShort.toUnsignedInt(left)
Expand All @@ -303,7 +303,7 @@ object Hypotenuse:
inline given S16 is Orderable as orderable:

inline def compare
(inline left: S16, inline right: S16, inline strict: Boolean, inline greaterThan: Boolean)
(inline left: S16, inline right: S16, inline strict: Boolean, inline greaterThan: Boolean)
: Boolean =

inline if greaterThan
Expand All @@ -319,11 +319,10 @@ object Hypotenuse:
given U8 is Textualizer = u8 => JByte.toUnsignedInt(u8).toString.nn.tt
inline def apply(inline bits: B8): U8 = bits


inline given U8 is Orderable as orderable:

inline def compare
(inline left: U8, inline right: U8, inline strict: Boolean, inline greaterThan: Boolean)
(inline left: U8, inline right: U8, inline strict: Boolean, inline greaterThan: Boolean)
: Boolean =

val left2 = JByte.toUnsignedInt(left)
Expand All @@ -348,7 +347,7 @@ object Hypotenuse:
inline given S8 is Orderable as inquality:

inline def compare
(inline left: S8, inline right: S8, inline strict: Boolean, inline greaterThan: Boolean)
(inline left: S8, inline right: S8, inline strict: Boolean, inline greaterThan: Boolean)
: Boolean =

inline if greaterThan
Expand Down
10 changes: 5 additions & 5 deletions src/core/hypotenuse.Hypotenuse2.scala
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ object Hypotenuse2:
Expr(int.toByte)

def commensurable
(expr: Expr[Boolean],
bound: Expr[Int | Double | Char | Byte | Short | Long | Float],
strict: Expr[Boolean],
greaterThan: Expr[Boolean])
(using Quotes)
(expr: Expr[Boolean],
bound: Expr[Int | Double | Char | Byte | Short | Long | Float],
strict: Expr[Boolean],
greaterThan: Expr[Boolean])
(using Quotes)
: Expr[Boolean] =

val errorMessage = m"this cannot be written as a range expression"
Expand Down
8 changes: 4 additions & 4 deletions src/core/hypotenuse.Orderable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import scala.annotation.*
object Orderable:
given [ValueType: Ordering] => ValueType is Orderable:
inline def compare
(inline left: ValueType,
inline right: ValueType,
inline strict: Boolean,
inline greater: Boolean)
(inline left: ValueType,
inline right: ValueType,
inline strict: Boolean,
inline greater: Boolean)
: Boolean =
val n = ValueType.compare(left, right)
inline if greater
Expand Down

0 comments on commit 619a19b

Please sign in to comment.