projects
/
debian
/
gcpegg
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
merge 64-bit fixes from Fernando Lucas Rodriguez <fernando_lr@terra.es>
[debian/gcpegg]
/
byteorder.h
diff --git
a/byteorder.h
b/byteorder.h
index 6071e53628796e9063736d940e6b53837676e271..783e904c0432e6109dcf737b54ce15fa15acdcd9 100644
(file)
--- a/
byteorder.h
+++ b/
byteorder.h
@@
-12,25
+12,25
@@
on RISC machines which typically require values to be
aligned at an even multiple of their length. */
on RISC machines which typically require values to be
aligned at an even multiple of their length. */
-#define pack
Short
(x) { \
-
short s = htons((short
) (x)); \
- memcpy(pktP, &s, sizeof(
short
)); \
- pktP += sizeof(
short
); \
+#define pack
16
(x) { \
+
uint16 s = htons((uint16
) (x)); \
+ memcpy(pktP, &s, sizeof(
uint16
)); \
+ pktP += sizeof(
uint16
); \
}
}
-#define pack
Long
(x) { \
-
long l = htonl((long
) (x)); \
- memcpy(pktP, &
l, sizeof(long
)); \
- pktP += sizeof(
long
); \
+#define pack
32
(x) { \
+
uint32 i = htonl((uint32
) (x)); \
+ memcpy(pktP, &
i, sizeof(uint32
)); \
+ pktP += sizeof(
uint32
); \
}
}
-#define pack
Byte
(x) { \
+#define pack
8
(x) { \
char c = (x); \
memcpy(pktP, &c, sizeof(char)); \
pktP += sizeof(char); \
}
char c = (x); \
memcpy(pktP, &c, sizeof(char)); \
pktP += sizeof(char); \
}
-#define pack
Byte
s(x, n) { \
+#define pack
8
s(x, n) { \
memcpy(pktP, x, n); \
pktP += n; \
}
memcpy(pktP, x, n); \
pktP += n; \
}
@@
-40,25
+40,25
@@
pktP. Note that the argument of these macros must be
an lvalue. */
pktP. Note that the argument of these macros must be
an lvalue. */
-#define unpack
Short
(x) { \
-
short
s; \
- memcpy(&s, pktP, sizeof(
short
)); \
- pktP += sizeof(
short
); \
+#define unpack
16
(x) { \
+
uint16
s; \
+ memcpy(&s, pktP, sizeof(
uint16
)); \
+ pktP += sizeof(
uint16
); \
x = ntohs(s); \
}
x = ntohs(s); \
}
-#define unpack
Long
(x) { \
-
long l
; \
- memcpy(&
l, pktP, sizeof(long
)); \
- pktP += sizeof(
long
); \
- x = ntohl(
l
); \
+#define unpack
32
(x) { \
+
uint32 i
; \
+ memcpy(&
i, pktP, sizeof(uint32
)); \
+ pktP += sizeof(
uint32
); \
+ x = ntohl(
i
); \
}
}
-#define unpack
Byte
(x) { \
+#define unpack
8
(x) { \
*((char *) &x) = (char) *pktP++; \
}
*((char *) &x) = (char) *pktP++; \
}
-#define unpack
Byte
s(x, n) { \
+#define unpack
8
s(x, n) { \
memcpy(x, pktP, n); \
pktP += n; \
}
memcpy(x, pktP, n); \
pktP += n; \
}