Skip to content

Conversation

@petermm
Copy link
Contributor

@petermm petermm commented Oct 12, 2025

Adds AArch64/ARM64 architecture detection to the unaligned memory access and byte-swapping macros.

Claude claims:

Erlang Code Pattern Speedup Example Use Case
Binary pattern matching (multi-byte) 5-10x <<A:64/big, B:32/big>> = Data
Network protocol parsing 5-8x TCP/IP, MQTT, HTTP headers
Sensor data reading (I2C/SPI) 3-5x <<Temp:16/big, Pressure:32/big>>
File I/O & serialization 2-5x term_to_binary(), binary files
Binary construction (multi-byte) 3-6x <<Value:64/big, Other:32/big>>
String/binary operations 1.5-3x Binary concatenation
Typical IoT application 15-30% Overall speedup

But something also tells me modern compilers already optimize these..

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

Adds AArch64/ARM64 architecture detection to the unaligned memory access
and byte-swapping macros.

Signed-off-by: Peter M <petermm@gmail.com>
bettio added a commit that referenced this pull request Oct 19, 2025
…sses

Fix unaligned memory accesses in bitstring

See also #1892 which is different
Updated `test_bs` doesn't work until #1895 is merged

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
@bettio bettio merged commit f2107a3 into atomvm:main Oct 19, 2025
208 of 214 checks passed
@petermm petermm deleted the aarch64-builtin_bswap branch October 19, 2025 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants