Skip to content

Commit

Permalink
Code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
plokhotnyuk committed Feb 9, 2024
1 parent 62c4856 commit 4f22404
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2883,12 +2883,12 @@ final class JsonReader private[jsoniter_scala](

private[this] def parseDuration(): Duration = {
var b = nextByte(head)
var s = 0
var s = 0L
if (b == '-') {
b = nextByte(head)
s = -1
s = ~s
}
if (b != 'P') durationOrPeriodStartError(s)
if (b != 'P') durationOrPeriodStartError(s.toInt)
b = nextByte(head)
var state = -1
if (b == 'T') {
Expand All @@ -2903,7 +2903,7 @@ final class JsonReader private[jsoniter_scala](
b = nextByte(head)
sx = ~sx
}
if (b < '0' || b > '9') durationOrPeriodDigitError(s, sx, state)
if (b < '0' || b > '9') durationOrPeriodDigitError(s.toInt, sx.toInt, state)
var x = ('0' - b).toLong
var pos = head
var buf = this.buf
Expand Down Expand Up @@ -2934,7 +2934,7 @@ final class JsonReader private[jsoniter_scala](
seconds = sumSeconds((sx - (x ^ sx)) * 60, seconds, pos)
state = 2
} else if (b == 'S' || b == '.') {
if ((sx | x) == -9223372036854775808L) durationError(pos)
if ((x | sx) == -9223372036854775808L) durationError(pos)
seconds = sumSeconds(sx - (x ^ sx), seconds, pos)
state = 3
if (b == '.') {
Expand Down Expand Up @@ -2976,7 +2976,7 @@ final class JsonReader private[jsoniter_scala](
}
}
if (b != 'S') nanoError(nanoDigitWeight, 'S', pos)
nano = (nano ^ sx) - sx
nano = ((nano ^ sx) - sx).toInt
}
} else durationError(state, pos)
b = nextByte(pos + 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2879,12 +2879,12 @@ final class JsonReader private[jsoniter_scala](

private[this] def parseDuration(): Duration = {
var b = nextByte(head)
var s = 0
var s = 0L
if (b == '-') {
b = nextByte(head)
s = -1
s = ~s
}
if (b != 'P') durationOrPeriodStartError(s)
if (b != 'P') durationOrPeriodStartError(s.toInt)
b = nextByte(head)
var state = -1
if (b == 'T') {
Expand All @@ -2899,7 +2899,7 @@ final class JsonReader private[jsoniter_scala](
b = nextByte(head)
sx = ~sx
}
if (b < '0' || b > '9') durationOrPeriodDigitError(s, sx, state)
if (b < '0' || b > '9') durationOrPeriodDigitError(s.toInt, sx.toInt, state)
var x = ('0' - b).toLong
var pos = head
var buf = this.buf
Expand Down Expand Up @@ -2930,7 +2930,7 @@ final class JsonReader private[jsoniter_scala](
seconds = sumSeconds((sx - (x ^ sx)) * 60, seconds, pos)
state = 2
} else if (b == 'S' || b == '.') {
if ((sx | x) == -9223372036854775808L) durationError(pos)
if ((x | sx) == -9223372036854775808L) durationError(pos)
seconds = sumSeconds(sx - (x ^ sx), seconds, pos)
state = 3
if (b == '.') {
Expand Down Expand Up @@ -2972,7 +2972,7 @@ final class JsonReader private[jsoniter_scala](
}
}
if (b != 'S') nanoError(nanoDigitWeight, 'S', pos)
nano = (nano ^ sx) - sx
nano = ((nano ^ sx) - sx).toInt
}
} else durationError(state, pos)
b = nextByte(pos + 1)
Expand Down

0 comments on commit 4f22404

Please sign in to comment.