[Lazarus] UTF8LengthFast returning incorrect results on AARCH64 (MacOS)

Noel Duffy noelduffy at xtra.co.nz
Mon Dec 27 22:10:51 CET 2021

On 28/12/21 01:47, Juha Manninen via lazarus wrote:
> On Mon, Dec 27, 2021 at 1:44 AM Noel Duffy via lazarus <
> lazarus at lists.lazarus-ide.org> wrote:
>> I need some help getting to the root of a problem with incorrect results
>> on Apple hardware (M1, aarch64) for the function UTF8LengthFast in lazutf8.
>> On MacOS, when given a string containing one or more UTF8 characters,
>> UTF8LengthFast returns wildly incorrect results. On Fedora, the function
>> returns the correct answer.
> You mean both MacOS and Fedora run on the same aarch64 CPU?

Oh no, Fedora runs on an Intel x86_64. I don't think there's a Fedora 
that runs on aarch64. I included the results from Fedora just to show 
that the code does work in some places.

> It must be a Big endian / Little endian issue. IIRC it can be adjusted in
> Why do MacOS and Linux use a different setting there? I have no idea.

Well, as Florian said above, the M1 is little-endian. So it doesn't 
appear to be an endian issue.


More information about the lazarus mailing list