Coverage Summary for Class: LongImplicits (lzwpack.implicits)

Class Method, % Line, %
LongImplicits 100% (2/ 2) 100% (2/ 2)
LongImplicits$LongOps 50% (3/ 6) 50% (3/ 6)
total 62.5% (5/ 8) 62.5% (5/ 8)


1 package lzwpack.implicits 2  3 import java.lang.{Long => JavaLong} 4  5 import lzwpack.data.{Binary, ListVector} 6  7 trait LongImplicits { 8  implicit class LongOps(n: Long) { 9  /** 10  * Returns the amount of significant bits in this Long. 11  */ 12  def bitsize: Int = Binary.bitsize(n) 13  14  /** 15  * Converts this Long into its binary representation. 16  */ 17  def bin: String = bin(JavaLong.SIZE) 18  def bin(size: Int): String = n.toBinaryString.reverse.padTo(size, "0").reverse.mkString 19  20  /** 21  * Converts this Long into its hexadecimal representation. 22  */ 23  def hex: String = n formatted "0x%02X" 24  } 25 }