ACK On 10/1/2012 4:21 PM, Jan Friesse wrote: > This uses general swabbin function which is able to swab every byte in > array. > > Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx> > --- > include/corosync/mar_gen.h | 22 ++++++++++++++++++++++ > 1 files changed, 22 insertions(+), 0 deletions(-) > > diff --git a/include/corosync/mar_gen.h b/include/corosync/mar_gen.h > index 622bbec..ad16d14 100644 > --- a/include/corosync/mar_gen.h > +++ b/include/corosync/mar_gen.h > @@ -91,6 +91,28 @@ static inline void swab_mar_uint64_t (mar_uint64_t *to_swab) > *to_swab = swab64 (*to_swab); > } > > +static inline void swabbin(char *data, size_t len) > +{ > + int i; > + char tmp; > + > + for (i = 0; i < len / 2; i++) { > + tmp = data[i]; > + data[i] = data[len - i - 1]; > + data[len - i - 1] = tmp; > + } > +} > + > +static inline void swabflt(float *flt) > +{ > + swabbin((char *)flt, sizeof(*flt)); > +} > + > +static inline void swabdbl(double *dbl) > +{ > + swabbin((char *)dbl, sizeof(*dbl)); > +} > + > typedef struct { > mar_uint16_t length __attribute__((aligned(8))); > mar_uint8_t value[CS_MAX_NAME_LENGTH] __attribute__((aligned(8))); > _______________________________________________ discuss mailing list discuss@xxxxxxxxxxxx http://lists.corosync.org/mailman/listinfo/discuss