Subject: lib/bitops

From: "Naik, Uday" <[email-masked]>
Date: Wed, 17 May 2000 18:23:00 -0700

There are a whole bunch of bit operations in arch/arm/lib.
For e.g. test_and_set_bit(). The way these operations are
written, they are byte oriented, for e.g. to set bit 12
it does a ldrb of the second byte and manipulates the 5th
bit of it. Is there a reason it is done like this rather
than reading in a word and setting the appropriate bit and
writing it back.

The reason I ask is that they break in big endian mode and
I need to rewrite them. But if I rewrite them word oriented
then they will work in either endian mode.

Thanks

Uday

---

All opinions expressed are mine and do not reflect those of my employer.

unsubscribe: body of `unsubscribe linux-arm-kernel' to [email-masked]

---

From: Russell King - ARM Linux Admin <[email-masked]>
Date: Thu, 18 May 2000 08:27:13 +0100 (BST)

Naik, Uday writes:
> Is there a reason it is done like this rather than reading in a word
> and setting the appropriate bit and writing it back.

Yes, because you need one extra instruction.  These macros are supposed
to be fast, so that's something we don't really want to add.  (hmm, the
current code isn't as fast as it ought to be actually - fixing now).
   _____
  |_____| ------------------------------------------------- ---+---+-
  |   |        Russell King       [email-masked]      --- ---
  | | | |            http://www.arm.linux.org.uk/            /  /  |
  | +-+-+                                                     --- -+-
  /   |               THE developer of ARM Linux              |+| /|\
 /  | | |                                                     ---  |
    +-+-+ -------------------------------------------------  /\\\  |