cast pointers to uintptr_t for alignement check

This commit is contained in:
Martin Willi
2009-07-15 10:39:45 +02:00
parent 0ead254919
commit 74b14b4008
+3 -2
View File
@@ -20,6 +20,7 @@
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <stdint.h>
#include <limits.h>
#include <dirent.h>
#include <time.h>
@@ -63,12 +64,12 @@ void memxor(u_int8_t dst[], u_int8_t src[], size_t n)
int m, i;
/* byte wise XOR until dst aligned */
for (i = 0; (int)&dst[i] % sizeof(long); i++)
for (i = 0; (uintptr_t)&dst[i] % sizeof(long); i++)
{
dst[i] ^= src[i];
}
/* try to use words if src shares an aligment with dst */
switch (((int)&src[i] % sizeof(long)))
switch (((uintptr_t)&src[i] % sizeof(long)))
{
case 0:
for (m = n - sizeof(long); i <= m; i += sizeof(long))