ObjFW  Check-in [11489e7218]

Overview
Comment:Improve OF_ROL.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 11489e72189cb6d0bf9a5740b0e4f71730abc66695a0b1272636aa3de6ad9ba4
User & Date: js on 2010-04-10 13:46:14
Other Links: manifest | tags
Context
2010-04-10
16:13
Add -[writeFormat:withArguments:] to OFStream. check-in: 948a5c25ce user: js tags: trunk
13:46
Improve OF_ROL. check-in: 11489e7218 user: js tags: trunk
13:32
Prevent repeated evaluation of i in OF_BSWAP{16,32,64}_CONST. check-in: c5b72902da user: js tags: trunk
Changes

Modified src/macros.h from [0c7fd6a945] to [fc4c29980c].

162
163
164
165
166
167
168
169
170



171
172
173
174
175
176
177
162
163
164
165
166
167
168


169
170
171
172
173
174
175
176
177
178







-
-
+
+
+







# define OF_BSWAP64_IF_BE(i) i
# define OF_BSWAP16_IF_LE(i) OF_BSWAP16(i)
# define OF_BSWAP32_IF_LE(i) OF_BSWAP32(i)
# define OF_BSWAP64_IF_LE(i) OF_BSWAP64(i)
# define OF_BSWAP32_V_IF_BE(buf, len)
#endif

#define OF_ROL(val, bits) \
	(((val) << (bits)) | ((val) >> (32 - (bits))))
#define OF_ROL(val, bits)						\
	(((val) << ((bits) % (sizeof(val) * 8))) |			\
	(val) >> (sizeof(val) * 8 - ((bits) % (sizeof(val) * 8))))

#define OF_HASH_INIT(hash) hash = 0
#define OF_HASH_ADD(hash, byte)		\
	{				\
		hash += byte;		\
		hash += (hash << 10);	\
		hash ^= (hash >> 6);	\