Skip to content

Commit

Permalink
Update to moonc v0.1.20241011+9ea637707
Browse files Browse the repository at this point in the history
Signed-off-by: Glenn Lewis <[email protected]>
  • Loading branch information
gmlewis committed Oct 12, 2024
1 parent d155773 commit d15d566
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,9 @@ The code has been updated to support compiler:

```bash
$ moon version --all
moon 0.1.20240914 (e22cb71 2024-09-14) ~/.moon/bin/moon
moonc v0.1.20240914+b541585d3 ~/.moon/bin/moonc
moonrun 0.1.20240914 (e22cb71 2024-09-14) ~/.moon/bin/moonrun
moon 0.1.20241011 (ca50f51 2024-10-11) ~/.moon/bin/moon
moonc v0.1.20241011+9ea637707 ~/.moon/bin/moonc
moonrun 0.1.20241011 (ca50f51 2024-10-11) ~/.moon/bin/moonrun
```

Use `moonup` to manage `moon` compiler versions:
Expand Down
2 changes: 1 addition & 1 deletion examples/arrays/strings.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub fn process_strings(strings : Array[String]) -> Array[String] {
strings.eachi(
fn(index, value) {
parts.push(value)
strings[index] = parts.join("|")
strings[index] = String::concat(parts, separator="|")
},
)
strings
Expand Down
2 changes: 1 addition & 1 deletion moon.mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "extism/moonbit-pdk",
"version": "0.40.0",
"version": "0.41.0",
"deps": {},
"readme": "README.md",
"repository": "https://github.com/extism/moonbit-pdk",
Expand Down
6 changes: 3 additions & 3 deletions pdk/host/memory.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ pub fn to_string(self : Memory) -> String {
pub fn to_int(self : Memory) -> Int {
let bytes = self.to_bytes()
bytes[0].to_int() +
bytes[1].to_int().lsl(8) +
bytes[2].to_int().lsl(16) +
bytes[3].to_int().lsl(24)
(bytes[1].to_int() << 8) +
(bytes[2].to_int() << 16) +
(bytes[3].to_int() << 24)
}

/// `to_bytes` reads the (unprocessed) bytes residing in the host memory
Expand Down
2 changes: 1 addition & 1 deletion pdk/string.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub impl ToUtf16 for Bytes with to_utf16(b : Bytes) -> String {
// For now, support ASCII.
// https://github.com/moonbitlang/core/issues/484
let length = b.length()
let buf = Buffer::new(size_hint=2 * length)
let buf = @buffer.new(size_hint=2 * length)
for i = 0; i < length; i = i + 1 {
let byte = b[i].to_int()
let char = Char::from_int(byte)
Expand Down
6 changes: 3 additions & 3 deletions pdk/var/var.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ pub fn set_int(key : String, value : Int) -> Unit {
let key_mem = @host.allocate_string(key)
let bytes = Bytes::new(4)
bytes[0] = value.land(255).to_byte()
bytes[1] = value.lsr(8).land(255).to_byte()
bytes[2] = value.lsr(16).land(255).to_byte()
bytes[3] = value.lsr(24).land(255).to_byte()
bytes[1] = (value >> 8).land(255).to_byte()
bytes[2] = (value >> 16).land(255).to_byte()
bytes[3] = (value >> 24).land(255).to_byte()
let val_mem = @host.allocate_bytes(bytes)
@extism.var_set(key_mem.offset, val_mem.offset)
key_mem.free()
Expand Down

0 comments on commit d15d566

Please sign in to comment.