RE: [PATCH v1] asm-generic: introduce be56 unaligned accessors
From: David Laight
Date: Tue Oct 08 2024 - 05:08:29 EST
...
> I'm using block read in order to get multiple registers at a time
> (around 76 bytes) and to increase the efficiency of the transfer over
> I2C. Being a block read there are different registers length involved
> from 16 up to 56 bits long and I need to unpack.
You could do an unaligned 64bit BE read and then shift the value right 8 bits
(and only advance the pointer 7 bytes).
Safe because you can guarantee a spare byte at the end of the data.
On x86-64 you could do that for all sizes!
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)