linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: "'Marius.Cristea@microchip.com'" <Marius.Cristea@microchip.com>,
	"arnd@arndb.de" <arnd@arndb.de>
Cc: "linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v1] asm-generic: introduce be56 unaligned accessors
Date: Tue, 8 Oct 2024 09:03:27 +0000	[thread overview]
Message-ID: <8280ddecc4e14643b446c018d89fab28@AcuMS.aculab.com> (raw)
In-Reply-To: <2f53046dd5b791845c2ffa783d7637ca94ca330c.camel@microchip.com>

...
> 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)

  parent reply	other threads:[~2024-10-08  9:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-27  8:35 [PATCH v1] asm-generic: introduce be56 unaligned accessors marius.cristea
2024-09-29 21:16 ` David Laight
2024-10-07 14:40   ` Marius.Cristea
2024-10-07 14:44     ` Arnd Bergmann
2024-10-07 14:57       ` Marius.Cristea
2024-10-07 17:08         ` Arnd Bergmann
2024-10-08  9:03         ` David Laight [this message]
2024-10-07 15:05       ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8280ddecc4e14643b446c018d89fab28@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=Marius.Cristea@microchip.com \
    --cc=arnd@arndb.de \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).