Skip to content

Commit db993dc

Browse files
committed
chore: String.getUTF8Byte
1 parent ee8f0cc commit db993dc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Init/Data/String/Basic.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,15 @@ At runtime, this function is implemented by efficient, constant-time code.
804804
def getUtf8Byte (s : @& String) (p : Pos.Raw) (h : p < s.endPos) : UInt8 :=
805805
s.bytes[p.byteIdx]
806806

807+
/--
808+
Accesses the indicated byte in the UTF-8 encoding of a string.
809+
810+
At runtime, this function is implemented by efficient, constant-time code.
811+
-/
812+
@[extern "lean_string_get_byte_fast", expose]
813+
def getUTF8Byte (s : @& String) (p : Pos.Raw) (h : p < s.endPos) : UInt8 :=
814+
s.bytes[p.byteIdx]
815+
807816
@[simp]
808817
theorem endPos_empty : "".endPos = 0 := rfl
809818

0 commit comments

Comments
 (0)