On Tue, Dec 15, 2015 at 11:34:24AM +0300, Andrei Borzenkov wrote: > 15.12.2015 03:34, Jaegeuk Kim пишет: > > Change log from v3: > > o add grub_test_bit_le() > ... > > > + > > +static inline int > > +grub_f2fs_test_bit_le (int nr, const grub_uint8_t *addr) > > +{ > > + const grub_int32_t *p = (const grub_int32_t *)addr; > > + > > + nr = nr ^ 0; > > It does nothing.
Ah, right. > > > + > > + return p[nr >> 5] & (1 << (nr & 31)); > > +} > > Well, you still miss the point - if you are working with integers you > must shift differently depending on whether we are running big or little > endian. I just thought that it would be okay to bypass 32bits and then check its target location, since we know it is LE. Indeed, I was wrong that your concern was this line will be converted to BE when CPU loads this 32-bit value. > But as I mentioned before, we know that bitmap is little endian so we > can work with bytes and be independent of byte order. Could you test if > this works for you: > > static inline int > grub_f2fs_test_bit_le (int nr, const grub_uint8_t *addr) > { > return addr[nr >> 3] & (1 << (nr & 7)); > } Actually, I tested this before, but I got somehow failure, so tried this one. Once I've checked bitmap contents in more details, I realized that this should be a correct way; I confirmed that this has no problem. I'll send another patch. Thank you so much, _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel