Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@ name: CI
on:
pull_request:
schedule:
# Run daily at 8 PM UTC, after the nightlies are typically published.
- cron: '0 20 * * *'
# Run daily at 11 AM UTC, after the nightlies are typically published.
- cron: '0 11 * * *'
workflow_dispatch:

jobs:
test:
name: package examples (${{ matrix.os }})
name: ci/all_tests.sh (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-15-intel
- ubuntu-26.04
- macos-26-intel
- macos-26
- windows-2025
defaults:
run:
shell: bash

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Install Zig
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # 2.2.1
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ concurrency:
jobs:
build-bundle:
name: Build package bundle
runs-on: ubuntu-latest
runs-on: ubuntu-26.04
outputs:
bundle_filename: ${{ steps.bundle.outputs.bundle_filename }}
defaults:
Expand All @@ -28,7 +28,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Install Zig
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # 2.2.1
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
echo "bundle_filename=$BUNDLE_FILENAME" >> "$GITHUB_OUTPUT"

- name: Upload package bundle artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: package-bundle
path: dist/${{ steps.bundle.outputs.bundle_filename }}
Expand All @@ -79,16 +79,17 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-15-intel
- ubuntu-26.04
- macos-26-intel
- macos-26
- windows-2025
defaults:
run:
shell: bash

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Install Zig
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # 2.2.1
Expand All @@ -103,7 +104,7 @@ jobs:
version: nightly-new-compiler

- name: Download package bundle artifact
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: package-bundle
path: dist
Expand All @@ -126,10 +127,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Download package bundle artifact
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: package-bundle
path: dist
Expand Down
30 changes: 15 additions & 15 deletions package/Path.roc
Original file line number Diff line number Diff line change
Expand Up @@ -158,31 +158,31 @@ utf8_to_utf16 = |remaining, out|
utf8_to_utf16(rest, out.append(U8.to_u16(byte)))

[byte1, byte2, .. as rest] if byte1 < 0xE0 => {
top = U32.shift_left_by(U8.to_u32(U8.bitwise_and(byte1, 0x1F)), 6)
top = U32.shl_wrap(U8.to_u32(U8.bitwise_and(byte1, 0x1F)), 6)
bottom = U8.to_u32(U8.bitwise_and(byte2, 0x3F))
code_point = U32.bitwise_or(top, bottom)

utf8_to_utf16(rest, out.append(U32.to_u16_wrap(code_point)))
}

[byte1, byte2, byte3, .. as rest] if byte1 < 0xF0 => {
top = U32.shift_left_by(U8.to_u32(U8.bitwise_and(byte1, 0x0F)), 12)
middle = U32.shift_left_by(U8.to_u32(U8.bitwise_and(byte2, 0x3F)), 6)
top = U32.shl_wrap(U8.to_u32(U8.bitwise_and(byte1, 0x0F)), 12)
middle = U32.shl_wrap(U8.to_u32(U8.bitwise_and(byte2, 0x3F)), 6)
bottom = U8.to_u32(U8.bitwise_and(byte3, 0x3F))
code_point = U32.bitwise_or(U32.bitwise_or(top, middle), bottom)

utf8_to_utf16(rest, out.append(U32.to_u16_wrap(code_point)))
}

[byte1, byte2, byte3, byte4, .. as rest] => {
top = U32.shift_left_by(U8.to_u32(U8.bitwise_and(byte1, 0x07)), 18)
middle1 = U32.shift_left_by(U8.to_u32(U8.bitwise_and(byte2, 0x3F)), 12)
middle2 = U32.shift_left_by(U8.to_u32(U8.bitwise_and(byte3, 0x3F)), 6)
top = U32.shl_wrap(U8.to_u32(U8.bitwise_and(byte1, 0x07)), 18)
middle1 = U32.shl_wrap(U8.to_u32(U8.bitwise_and(byte2, 0x3F)), 12)
middle2 = U32.shl_wrap(U8.to_u32(U8.bitwise_and(byte3, 0x3F)), 6)
bottom = U8.to_u32(U8.bitwise_and(byte4, 0x3F))
upper = U32.bitwise_or(U32.bitwise_or(top, middle1), middle2)
code_point = U32.bitwise_or(upper, bottom)

high = U32.to_u16_wrap(0xD800 + U32.shift_right_by(code_point - 0x10000, 10))
high = U32.to_u16_wrap(0xD800 + U32.shr_wrap(code_point - 0x10000, 10))
low = U32.to_u16_wrap(0xDC00 + U32.bitwise_and(code_point - 0x10000, 0x3FF))

utf8_to_utf16(rest, out.append(high).append(low))
Expand Down Expand Up @@ -211,7 +211,7 @@ utf16_to_utf8 = |remaining, out, index|
[] => Ok(out)

[high, low, .. as rest] if is_high_surrogate(high) and is_low_surrogate(low) => {
high_bits = U32.shift_left_by(U16.to_u32(high) - 0xD800, 10)
high_bits = U32.shl_wrap(U16.to_u32(high) - 0xD800, 10)
low_bits = U16.to_u32(low) - 0xDC00
code_point = 0x10000 + high_bits + low_bits

Expand All @@ -233,7 +233,7 @@ utf16_to_utf8_lossy_help = |remaining, out|
[] => out

[high, low, .. as rest] if is_high_surrogate(high) and is_low_surrogate(low) => {
high_bits = U32.shift_left_by(U16.to_u32(high) - 0xD800, 10)
high_bits = U32.shl_wrap(U16.to_u32(high) - 0xD800, 10)
low_bits = U16.to_u32(low) - 0xDC00
code_point = 0x10000 + high_bits + low_bits

Expand All @@ -252,16 +252,16 @@ append_code_point_utf8 = |out, code_point|
if code_point < 0x80 {
out.append(U32.to_u8_wrap(code_point))
} else if code_point < 0x800 {
out.append(U32.to_u8_wrap(0xC0 + U32.shift_right_by(code_point, 6)))
out.append(U32.to_u8_wrap(0xC0 + U32.shr_wrap(code_point, 6)))
.append(U32.to_u8_wrap(0x80 + U32.bitwise_and(code_point, 0x3F)))
} else if code_point < 0x10000 {
out.append(U32.to_u8_wrap(0xE0 + U32.shift_right_by(code_point, 12)))
.append(U32.to_u8_wrap(0x80 + U32.bitwise_and(U32.shift_right_by(code_point, 6), 0x3F)))
out.append(U32.to_u8_wrap(0xE0 + U32.shr_wrap(code_point, 12)))
.append(U32.to_u8_wrap(0x80 + U32.bitwise_and(U32.shr_wrap(code_point, 6), 0x3F)))
.append(U32.to_u8_wrap(0x80 + U32.bitwise_and(code_point, 0x3F)))
} else {
out.append(U32.to_u8_wrap(0xF0 + U32.shift_right_by(code_point, 18)))
.append(U32.to_u8_wrap(0x80 + U32.bitwise_and(U32.shift_right_by(code_point, 12), 0x3F)))
.append(U32.to_u8_wrap(0x80 + U32.bitwise_and(U32.shift_right_by(code_point, 6), 0x3F)))
out.append(U32.to_u8_wrap(0xF0 + U32.shr_wrap(code_point, 18)))
.append(U32.to_u8_wrap(0x80 + U32.bitwise_and(U32.shr_wrap(code_point, 12), 0x3F)))
.append(U32.to_u8_wrap(0x80 + U32.bitwise_and(U32.shr_wrap(code_point, 6), 0x3F)))
.append(U32.to_u8_wrap(0x80 + U32.bitwise_and(code_point, 0x3F)))
}

Expand Down
Loading