[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua define ARRAY_FLEXIBLE_MEMBER
- From: bil til <biltil52@...>
- Date: Wed, 16 Nov 2022 09:33:52 +0100
Am Di., 15. Nov. 2022 um 23:40 Uhr schrieb Gé Weijers <ge@weijers.org>:
>
> "&type[1]" the pointer generated may actually not be correctly aligned for the type of 'data'.
> You may not notice on a PC or an advanced ARM processor, but not all embedded CPUs can do misaligned accesses,
Sorry, I have to protest here... Cortex M4/M7 controllers are the
state-of-the-art embedded ARM processors, but they of course can NOT
do misaligned accesses - they would IMMEDIATLY run into some hardware
fault ... (at least they do THIS, so you can somehow track quite
easily where it happened).
If you program a function like memcpy, you first have to check
tediously and cumbersomely that your first handle the bytes very
slowly, until both source and target addresses are aligned... and only
then memcpy would start using int copy commands to speed up the copy
process by factor 4 or 8... .
The only machines which would do this cumbersome procedure in hardware
(thus allowing misaligned access in many times), are the PC CPUs e. g.
by Intel / AMD... .