From c64ae2fcabf9f2add6af92b9496da4a3dfce12f1 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Fri, 5 Jan 1996 02:43:19 +0000 Subject: [PATCH] gssapiP_generic.h (TWRITE_INT16, TREAD_INT16): Added new macros to read and write two byte integers from the wire. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7276 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/gssapi/generic/ChangeLog | 3 +++ src/lib/gssapi/generic/gssapiP_generic.h | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/lib/gssapi/generic/ChangeLog b/src/lib/gssapi/generic/ChangeLog index e2d043315..fc79eb2c1 100644 --- a/src/lib/gssapi/generic/ChangeLog +++ b/src/lib/gssapi/generic/ChangeLog @@ -1,5 +1,8 @@ Thu Jan 4 21:33:38 1996 Theodore Y. Ts'o + * gssapiP_generic.h (TWRITE_INT16, TREAD_INT16): Added new macros + to read and write two byte integers from the wire. + * gssapiP_generic.h: Don't include since it's already included by gssapi.h. diff --git a/src/lib/gssapi/generic/gssapiP_generic.h b/src/lib/gssapi/generic/gssapiP_generic.h index c0bd6fcaf..37ccffd53 100644 --- a/src/lib/gssapi/generic/gssapiP_generic.h +++ b/src/lib/gssapi/generic/gssapiP_generic.h @@ -46,6 +46,11 @@ (ptr)[3] = (char) ((bigend)?((num)&0xff):((num)>>24)); \ (ptr) += 4; +#define TWRITE_INT16(ptr, num, bigend) \ + (ptr)[0] = (char) ((bigend)?((num)>>24):((num)&0xff)); \ + (ptr)[1] = (char) ((bigend)?(((num)>>16)&0xff):(((num)>>8)&0xff)); \ + (ptr) += 2; + #define TREAD_INT(ptr, num, bigend) \ (num) = (((ptr)[0]<<((bigend)?24: 0)) | \ ((ptr)[1]<<((bigend)?16: 8)) | \ @@ -53,6 +58,11 @@ ((ptr)[3]<<((bigend)? 0:24))); \ (ptr) += 4; +#define TREAD_INT16(ptr, num, bigend) \ + (num) = (((ptr)[0]<<((bigend)?24: 0)) | \ + ((ptr)[1]<<((bigend)?16: 8))); \ + (ptr) += 2; + #define TWRITE_STR(ptr, str, len) \ memcpy((ptr), (char *) (str), (len)); \ (ptr) += (len); -- 2.26.2