Skip to content

Commit

Permalink
Reinstated + and * methods on ByteSize
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Oct 8, 2023
1 parent 093fbf3 commit aaaef2c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/core/bin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,18 @@ object Rudiments:
type Result = ByteSize
inline def apply(left: ByteSize, right: Int): ByteSize = left/right

extension (bs: ByteSize)
def long: Long = bs
def text: Text = (bs.toString+" bytes").tt
extension (left: ByteSize)
def long: Long = left
def text: Text = (left.toString+" bytes").tt

@targetName("plus")
def +(right: ByteSize): ByteSize = left + right

@targetName("times")
def *(right: Int): ByteSize = left*right

@targetName("times2")
def *(right: Long): ByteSize = left*right

def inequality
(expr: Expr[Boolean], bound: Expr[Int | Double | Char | Byte | Short | Long | Float],
Expand Down

0 comments on commit aaaef2c

Please sign in to comment.