Skip to content

Commit

Permalink
fixed translation of negative bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
sealmove committed Nov 14, 2021
1 parent 9878485 commit e854281
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ class NimTranslator(provider: TypeProvider, importList: ImportList) extends Base
if (arr.size == 0)
s"@[]"
else
"@[" + arr.mkString("'u8, ") + "'u8]"
"@[" + arr.map(b => {
val ub: Int = b & 0xff
ub
}).mkString("'u8, ") + "'u8]"
}
override def doByteArrayNonLiteral(elts: Seq[expr]): String =
s"@[${elts.map(translate).mkString(", ")}]"
Expand Down

0 comments on commit e854281

Please sign in to comment.