Skip to content

Commit

Permalink
use cheaper OP
Browse files Browse the repository at this point in the history
  • Loading branch information
Filip Schramka committed Dec 4, 2023
1 parent 4b61d9d commit 8dbc730
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions asn1scala/src/main/scala/asn1scala/asn1jvm_Bitstream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -650,9 +650,9 @@ case class BitStream(

def alignToShort(): Unit = {
require(validate_offset_bits(
(NO_OF_BITS_IN_SHORT - // max alignment (16) -
(NO_OF_BITS_IN_BYTE * (currentByte % NO_OF_BYTES_IN_JVM_SHORT) + currentBit) // current pos
) % NO_OF_BITS_IN_SHORT) // edge case (0,0) -> 0
(NO_OF_BITS_IN_SHORT - // max alignment (16) -
(NO_OF_BITS_IN_BYTE * (currentByte & (NO_OF_BYTES_IN_JVM_SHORT - 1)) + currentBit) // current pos
) & (NO_OF_BITS_IN_SHORT - 1)) // edge case (0,0) -> 0
)

alignToByte()
Expand All @@ -661,9 +661,9 @@ case class BitStream(

def alignToInt(): Unit = {
require(validate_offset_bits(
(NO_OF_BITS_IN_INT - // max alignment (32) -
(NO_OF_BITS_IN_BYTE * (currentByte % NO_OF_BYTES_IN_JVM_INT) + currentBit) // current pos
) % NO_OF_BITS_IN_INT) // edge case (0,0) -> 0
(NO_OF_BITS_IN_INT - // max alignment (32) -
(NO_OF_BITS_IN_BYTE * (currentByte & (NO_OF_BYTES_IN_JVM_INT - 1)) + currentBit) // current pos
) & (NO_OF_BITS_IN_INT - 1)) // edge case (0,0) -> 0
)

alignToByte()
Expand Down

0 comments on commit 8dbc730

Please sign in to comment.