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>] [day] [month] [year] [list]
Message-Id: <1171670571.7850.27.camel@localhost.localdomain>
Date:	Sat, 17 Feb 2007 11:02:51 +1100
From:	"Darren Jenkins\\" <darrenrjenkins@...il.com>
To:	kernel Janitors <kernel-janitors@...ts.osdl.org>
Cc:	LKML <linux-kernel@...r.kernel.org>
Subject: [kj][RFC] roll macro's in bitops.h

G'day people,

I was looking at bitops.h and noticed there were a couple of inline roll
functions to operate on 32bit variables. (left and right)

I think that is a little bit dumb as they are constant width (only
32bits) due to it being an inline function, and was wondering if anyone
thought it would be useful to have some (variable sized) roll macros
instead.

I whipped these twp up as examples, but have not tested them yet.

#define RollRight(Data, Distance) \
({      typeof(Data) __a = Data;   \
        typeof(Distance) __b = Distance%(sizeof(__a) * 8); \
	__a = ((__a>>__b) | (__a<<((sizeof(__a) * 8) - __b))) \
	__a; \
})

#define RollLeft(Data, Distance) \
({      typeof(Data) __a = Data;   \
        typeof(Distance) __b = Distance%(sizeof(__a) * 8); \
	__a = ((__a<<__b) | (__a>>((sizeof(__a) * 8) - __b))) \
	__a; \
})

Also if these are useful I was wondering how to handle the existing
functions ? #define them out for the time being ?

#define rol32(a, b) RollLeft(a, b)
#define ror32(a, b) RollRight(a, b)




Darren Jenkins


-
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