41 #if (defined(__linux) || defined(__APPLE__)) && \
42 (defined(__i386__) || defined(__x86_64__)) && \
48 #if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1000
52 #if defined(R__USEASMSWAP) && !defined(__CINT__)
57 inline void tobuf(
char *&buf, Bool_t x)
63 inline void tobuf(
char *&buf, UChar_t x)
68 inline void tobuf(
char *&buf, UShort_t x)
71 # if defined(R__USEASMSWAP)
72 *((UShort_t *)buf) = Rbswap_16(x);
75 const UShort_t *intermediary = &x;
76 char *sw = (
char *) intermediary;
81 memcpy(buf, &x,
sizeof(UShort_t));
83 buf +=
sizeof(UShort_t);
86 inline void tobuf(
char *&buf, UInt_t x)
89 # if defined(R__USEASMSWAP)
90 *((UInt_t *)buf) = Rbswap_32(x);
93 const UInt_t *intermediary = &x;
94 char *sw = (
char *)intermediary;
101 memcpy(buf, &x,
sizeof(UInt_t));
103 buf +=
sizeof(UInt_t);
106 inline void tobuf(
char *&buf, ULong_t x)
110 const ULong_t *intermediary = &x;
111 char *sw = (
char *)intermediary;
112 if (
sizeof(ULong_t) == 8) {
132 if (
sizeof(ULong_t) == 8) {
139 memcpy(buf+4, &x, 4);
145 inline void tobuf(
char *&buf, Long_t x)
149 const Long_t *intermediary = &x;
150 char *sw = (
char *)intermediary;
151 if (
sizeof(Long_t) == 8) {
178 if (
sizeof(Long_t) == 8) {
192 memcpy(buf+4, &x, 4);
198 inline void tobuf(
char *&buf, ULong64_t x)
201 # if defined(R__USEASMSWAP)
202 *((ULong64_t *)buf) = Rbswap_64(x);
205 const ULong64_t *intermediary = &x;
206 char *sw = (
char *)intermediary;
217 memcpy(buf, &x,
sizeof(ULong64_t));
219 buf +=
sizeof(ULong64_t);
222 inline void tobuf(
char *&buf, Float_t x)
225 # if defined(R__USEASMSWAP)
231 *((UInt_t *)buf) = Rbswap_32(u.i);
244 memcpy(buf, &x,
sizeof(Float_t));
246 buf +=
sizeof(Float_t);
249 inline void tobuf(
char *&buf, Double_t x)
252 # if defined(R__USEASMSWAP)
254 volatile ULong64_t l;
258 *((ULong64_t *)buf) = Rbswap_64(u.l);
275 memcpy(buf, &x,
sizeof(Double_t));
277 buf +=
sizeof(Double_t);
280 inline void frombuf(
char *&buf, Bool_t *x)
284 *x = (Bool_t) (x1 != 0);
287 inline void frombuf(
char *&buf, UChar_t *x)
292 inline void frombuf(
char *&buf, UShort_t *x)
295 # if defined(R__USEASMSWAP)
296 *x = Rbswap_16(*((UShort_t *)buf));
298 char *sw = (
char *)x;
303 memcpy(x, buf,
sizeof(UShort_t));
305 buf +=
sizeof(UShort_t);
308 inline void frombuf(
char *&buf, UInt_t *x)
311 # if defined(R__USEASMSWAP)
312 *x = Rbswap_32(*((UInt_t *)buf));
314 char *sw = (
char *)x;
321 memcpy(x, buf,
sizeof(UInt_t));
323 buf +=
sizeof(UInt_t);
326 inline void frombuf(
char *&buf, ULong_t *x)
329 char *sw = (
char *)x;
330 if (
sizeof(ULong_t) == 8) {
346 if (
sizeof(ULong_t) == 8) {
355 inline void frombuf(
char *&buf, ULong64_t *x)
358 # if defined(R__USEASMSWAP)
359 *x = Rbswap_64(*((ULong64_t *)buf));
361 char *sw = (
char *)x;
372 memcpy(x, buf,
sizeof(ULong64_t));
374 buf +=
sizeof(ULong64_t);
377 inline void frombuf(
char *&buf, Float_t *x)
380 # if defined(R__USEASMSWAP)
386 u.i = Rbswap_32(*((UInt_t *)buf));
400 memcpy(x, buf,
sizeof(Float_t));
402 buf +=
sizeof(Float_t);
405 inline void frombuf(
char *&buf, Double_t *x)
408 # if defined(R__USEASMSWAP)
411 volatile ULong64_t l;
414 u.l = Rbswap_64(*((ULong64_t *)buf));
432 memcpy(x, buf,
sizeof(Double_t));
434 buf +=
sizeof(Double_t);
437 inline void tobuf(
char *&buf, Char_t x) { tobuf(buf, (UChar_t) x); }
438 inline void tobuf(
char *&buf, Short_t x) { tobuf(buf, (UShort_t) x); }
439 inline void tobuf(
char *&buf, Int_t x) { tobuf(buf, (UInt_t) x); }
440 inline void tobuf(
char *&buf, Long64_t x) { tobuf(buf, (ULong64_t) x); }
442 inline void frombuf(
char *&buf, Char_t *x) { frombuf(buf, (UChar_t *) x); }
443 inline void frombuf(
char *&buf, Short_t *x) { frombuf(buf, (UShort_t *) x); }
444 inline void frombuf(
char *&buf, Int_t *x) { frombuf(buf, (UInt_t *) x); }
445 inline void frombuf(
char *&buf, Long_t *x) { frombuf(buf, (ULong_t *) x); }
446 inline void frombuf(
char *&buf, Long64_t *x) { frombuf(buf, (ULong64_t *) x); }
451 inline UShort_t host2net(UShort_t x)
453 #if defined(R__USEASMSWAP)
456 return (((x & 0x00ff) << 8) | ((x & 0xff00) >> 8));
460 inline UInt_t host2net(UInt_t x)
462 #if defined(R__USEASMSWAP)
465 return (((x & 0x000000ffU) << 24) | ((x & 0x0000ff00U) << 8) |
466 ((x & 0x00ff0000U) >> 8) | ((x & 0xff000000U) >> 24));
470 inline ULong_t host2net(ULong_t x)
473 # if defined(R__USEASMSWAP)
476 char sw[
sizeof(ULong_t)];
480 char *sb = (
char *)&x;
492 return (ULong_t)host2net((UInt_t) x);
496 inline ULong64_t host2net(ULong64_t x)
498 #if defined(R__USEASMSWAP)
501 char sw[
sizeof(ULong64_t)];
503 *(ULong64_t *)tmp = x;
505 char *sb = (
char *)&x;
518 inline Float_t host2net(Float_t xx)
526 #if defined(R__USEASMSWAP)
527 u.i = Rbswap_32(u.i);
529 u.i = (((u.i & 0x000000ffU) << 24) | ((u.i & 0x0000ff00U) << 8) |
530 ((u.i & 0x00ff0000U) >> 8) | ((u.i & 0xff000000U) >> 24));
535 inline Double_t host2net(Double_t x)
537 #if defined(R__USEASMSWAP)
540 volatile ULong64_t l;
544 u.l = Rbswap_64(u.l);
547 char sw[
sizeof(Double_t)];
549 *(Double_t *)tmp = x;
551 char *sb = (
char *)&x;
564 inline UShort_t host2net(UShort_t x) {
return x; }
565 inline UInt_t host2net(UInt_t x) {
return x; }
566 inline ULong_t host2net(ULong_t x) {
return x; }
567 inline ULong_t host2net(ULong64_t x) {
return x; }
568 inline Float_t host2net(Float_t x) {
return x; }
569 inline Double_t host2net(Double_t x) {
return x; }
572 inline Short_t host2net(Short_t x) {
return host2net((UShort_t)x); }
573 inline Int_t host2net(Int_t x) {
return host2net((UInt_t)x); }
574 inline Long_t host2net(Long_t x) {
return host2net((ULong_t)x); }
575 inline Long64_t host2net(Long64_t x) {
return host2net((ULong64_t)x); }
577 inline UShort_t net2host(UShort_t x) {
return host2net(x); }
578 inline Short_t net2host(Short_t x) {
return host2net(x); }
579 inline UInt_t net2host(UInt_t x) {
return host2net(x); }
580 inline Int_t net2host(Int_t x) {
return host2net(x); }
581 inline ULong_t net2host(ULong_t x) {
return host2net(x); }
582 inline Long_t net2host(Long_t x) {
return host2net(x); }
583 inline ULong64_t net2host(ULong64_t x) {
return host2net(x); }
584 inline Long64_t net2host(Long64_t x) {
return host2net(x); }
585 inline Float_t net2host(Float_t x) {
return host2net(x); }
586 inline Double_t net2host(Double_t x) {
return host2net(x); }