lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACVxJT_UVRjkSK+kieYVpO4R+D-4S2bXaoK-apxMkuFAYsgi_A@mail.gmail.com>
Date:	Tue, 20 Mar 2012 16:03:24 +0200
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	Michal Nazarewicz <mina86@...a86.com>
Cc:	Christoph Lameter <cl@...ux-foundation.org>,
	Pekka Enberg <penberg@...nel.org>,
	Matt Mackall <mpm@...enic.com>, Tejun Heo <tj@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [RFC PATCH 1/6] kenrel.h: add ALIGN_OF_LAST_BIT()

On Tue, Mar 20, 2012 at 2:32 PM, Michal Nazarewicz <mina86@...a86.com> wrote:
> On Tue, 20 Mar 2012 11:21:19 +0100, Lai Jiangshan <laijs@...fujitsu.com>
> wrote:
>
>> Get the biggest 2**y that x % (2**y) == 0 for the align value.

>> --- a/include/linux/kernel.h
>> +++ b/include/linux/kernel.h
>> @@ -44,6 +44,8 @@
>>  #define PTR_ALIGN(p, a)                ((typeof(p))ALIGN((unsigned
>> long)(p), (a)))
>>  #define IS_ALIGNED(x, a)               (((x) & ((typeof(x))(a) - 1)) ==
>> 0)
>> +#define ALIGN_OF_LAST_BIT(x)   ((((x)^((x) - 1))>>1) + 1)
>
>
> Wouldn't ALIGNMENT() be less confusing? After all, that's what this macro is
> calculating, right? Alignment of given address.

Bits do not have alignment because they aren't directly addressable.
Can you hardcode this sequence with comment, because it looks too
special for macro.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ