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

Juha Manninen juha.manninen62 at gmail.com
Mon Dec 27 13:47:54 CET 2021


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?
It must be a Big endian / Little endian issue. IIRC it can be adjusted in
ARM CPUs.
Why do MacOS and Linux use a different setting there? I have no idea.

If somebody can figure out how to port the function, good.
Otherwise we can make UTF8LengthFast call the standard UTF8Length using an
IFDEF when needed. What is the correct define then?

Juha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20211227/8fb1a246/attachment.htm>


More information about the lazarus mailing list