Endian Support
[libbu (utility functions)]

Collaboration diagram for Endian Support:


Files

file  htester.c
 Test network float conversion.
file  htond.c
 convert doubles to host/network format
file  htonf.c
 convert floats to host/network format
file  xdr.c

Defines

#define SIZEOF_NETWORK_SHORT   2
#define SIZEOF_NETWORK_LONG   4
#define SIZEOF_NETWORK_FLOAT   4
#define SIZEOF_NETWORK_DOUBLE   8
#define BU_GLONGLONG(_cp)
#define BU_GLONG(_cp)
#define BU_GSHORT(_cp)
#define OUT_IEEE_ZERO
#define OUT_IEEE_NAN

Functions

void htond (unsigned char *out, const unsigned char *in, int count)
void ntohd (unsigned char *out, const unsigned char *in, int count)
void htonf (unsigned char *out, const unsigned char *in, int count)
void ntohf (unsigned char *out, const unsigned char *in, int count)
unsigned short bu_gshort (const unsigned char *msgp)
unsigned long bu_glong (const unsigned char *msgp)
unsigned char * bu_pshort (register unsigned char *msgp, register int s)
unsigned char * bu_plong (register unsigned char *msgp, register unsigned long l)
void htond (register unsigned char *out, register const unsigned char *in, int count)
 Host to Network Doubles.
void ntohd (register unsigned char *out, register const unsigned char *in, int count)
 Network to Host Doubles.
void htonf (register unsigned char *out, register const unsigned char *in, int count)
void ntohf (register unsigned char *out, register const unsigned char *in, int count)
unsigned char * bu_plong (register unsigned char *msgp, register long unsigned int l)

Define Documentation

#define SIZEOF_NETWORK_SHORT   2
 

Sizes of "network" format data. We use the same convention as the TCP/IP specification, namely, big-Endian, IEEE format, twos compliment. This is the BRL-CAD external data representation (XDR). See also the support routines in libbu/xdr.c

Definition at line 365 of file bu.h.

Referenced by rt_dsp_export5(), and rt_dsp_import5().

#define SIZEOF_NETWORK_LONG   4
 

Definition at line 366 of file bu.h.

Referenced by rt_ars_export5(), rt_ars_import5(), rt_bot_export5(), rt_bot_import5(), rt_dsp_export5(), rt_dsp_import5(), rt_extrude_export5(), rt_extrude_import5(), rt_metaball_export5(), rt_metaball_import5(), rt_nmg_import5(), rt_nurb_bytes(), rt_nurb_export5(), rt_nurb_import5(), rt_sketch_export5(), and rt_sketch_import5().

#define SIZEOF_NETWORK_FLOAT   4
 

Definition at line 367 of file bu.h.

Referenced by db5_type_sizeof_n_binu(), htonf(), ntohf(), rt_binunif_export5(), and rt_binunif_import5().

#define SIZEOF_NETWORK_DOUBLE   8
 

Definition at line 368 of file bu.h.

Referenced by db5_type_sizeof_n_binu(), htond(), ntohd(), rt_arb_export5(), rt_arb_import5(), rt_arbn_export5(), rt_arbn_import5(), rt_ars_export5(), rt_ars_import5(), rt_binunif_export5(), rt_binunif_import5(), rt_bot_export5(), rt_bot_import5(), rt_cline_export5(), rt_cline_import5(), rt_comb_export5(), rt_comb_import5(), rt_comb_v5_serialize(), rt_dsp_export5(), rt_dsp_import5(), rt_ehy_export5(), rt_ehy_import5(), rt_ell_export5(), rt_ell_import5(), rt_epa_export5(), rt_epa_import5(), rt_eto_export5(), rt_eto_import5(), rt_extrude_export5(), rt_extrude_import5(), rt_grp_export5(), rt_grp_import5(), rt_hlf_export5(), rt_hlf_import5(), rt_metaball_export5(), rt_metaball_import5(), rt_nurb_bytes(), rt_nurb_import5(), rt_part_export5(), rt_part_import5(), rt_pipe_export5(), rt_pipe_import5(), rt_rhc_export5(), rt_rhc_import5(), rt_rpc_export5(), rt_rpc_import5(), rt_sketch_export5(), rt_sketch_import5(), rt_superell_export5(), rt_superell_import5(), rt_tgc_export5(), rt_tgc_import5(), rt_tor_export5(), rt_tor_import5(), rt_xxx_export5(), and rt_xxx_import5().

#define BU_GLONGLONG _cp   ) 
 

Value:

((((long)((_cp)[0])) << 56) |   \
             (((long)((_cp)[1])) << 48) |       \
             (((long)((_cp)[2])) << 40) |       \
             (((long)((_cp)[3])) << 32) |       \
             (((long)((_cp)[4])) << 24) |       \
             (((long)((_cp)[5])) << 16) |       \
             (((long)((_cp)[6])) <<  8) |       \
              ((long)((_cp)[7])) )

Definition at line 2441 of file bu.h.

Referenced by db5_decode_length(), and db5_decode_signed().

#define BU_GLONG _cp   ) 
 

Value:

((((long)((_cp)[0])) << 24) |   \
             (((long)((_cp)[1])) << 16) |       \
             (((long)((_cp)[2])) <<  8) |       \
              ((long)((_cp)[3])) )

Definition at line 2450 of file bu.h.

Referenced by db5_decode_length(), and db5_decode_signed().

#define BU_GSHORT _cp   ) 
 

Value:

((((short)((_cp)[0])) << 8) | \
                       (_cp)[1] )

Definition at line 2455 of file bu.h.

Referenced by db5_decode_length(), and db5_decode_signed().

#define OUT_IEEE_ZERO
 

Value:

{ \
        *out++ = 0; \
        *out++ = 0; \
        *out++ = 0; \
        *out++ = 0; \
        *out++ = 0; \
        *out++ = 0; \
        *out++ = 0; \
        *out++ = 0; \
        continue; } \

Definition at line 80 of file htond.c.

#define OUT_IEEE_NAN
 

Value:

{ /* Signaling NAN */ \
        *out++ = 0xFF; \
        *out++ = 0xF0; \
        *out++ = 0x0B; \
        *out++ = 0xAD; \
        *out++ = 0x0B; \
        *out++ = 0xAD; \
        *out++ = 0x0B; \
        *out++ = 0xAD; \
        continue; } \

Definition at line 91 of file htond.c.


Function Documentation

void htond unsigned char *  out,
const unsigned char *  in,
int  count
 

Referenced by bu_cv_w_cookie(), bu_struct_export(), pd_3cont(), pd_3line(), pd_3move(), pd_3point(), pd_3space(), pd_arc(), pd_circle(), pd_cont(), pd_line(), pd_move(), pd_point(), pd_space(), pdv_3cont(), pdv_3line(), pdv_3move(), pdv_3point(), pdv_3space(), rt_binunif_export5(), rt_bot_export(), rt_bot_export5(), rt_cline_export(), rt_cline_export5(), rt_comb_v5_serialize(), rt_dsp_export5(), rt_ehy_export5(), rt_ell_export5(), rt_epa_export5(), rt_eto_export5(), rt_extrude_export(), rt_extrude_export5(), rt_grp_export5(), rt_hlf_export5(), rt_nmg_edisk(), rt_nmg_export_fastf(), rt_part_export(), rt_part_export5(), rt_pipe_export(), rt_pipe_export5(), rt_rhc_export5(), rt_rpc_export5(), rt_sketch_export5(), rt_superell_export5(), rt_tgc_export5(), rt_tor_export5(), and rt_xxx_export5().

void ntohd unsigned char *  out,
const unsigned char *  in,
int  count
 

Referenced by bu_cv_w_cookie(), bu_struct_import(), rt_arb_import5(), rt_arbn_import(), rt_arbn_import5(), rt_ars_export5(), rt_ars_import5(), rt_binunif_import5(), rt_bot_import(), rt_bot_import5(), rt_cline_import(), rt_cline_import5(), rt_comb_import5(), rt_dsp_import5(), rt_ehy_import5(), rt_ell_import5(), rt_epa_import5(), rt_eto_import5(), rt_extrude_import(), rt_extrude_import5(), rt_grp_import5(), rt_hlf_import5(), rt_metaball_import5(), rt_nmg_idisk(), rt_nmg_import_fastf(), rt_nurb_import5(), rt_part_import(), rt_part_import5(), rt_pipe_import(), rt_pipe_import5(), rt_rhc_import5(), rt_rpc_import5(), rt_sketch_import(), rt_sketch_import5(), rt_superell_import5(), rt_tgc_import5(), rt_tor_import5(), rt_vlist_import(), and rt_xxx_import5().

void htonf unsigned char *  out,
const unsigned char *  in,
int  count
 

Referenced by rt_binunif_export5().

void ntohf unsigned char *  out,
const unsigned char *  in,
int  count
 

Referenced by rt_binunif_import5().

unsigned short bu_gshort const unsigned char *  msgp  ) 
 

B U _ G S H O R T

Definition at line 69 of file xdr.c.

Referenced by rt_binunif_import5(), and rt_dsp_import5().

unsigned long bu_glong const unsigned char *  msgp  ) 
 

B U _ G L O N G

Definition at line 89 of file xdr.c.

Referenced by db_scan(), rt_arbn_import(), rt_arbn_import5(), rt_ars_import5(), rt_binunif_import5(), rt_bot_import(), rt_bot_import5(), rt_dsp_import5(), rt_extrude_import(), rt_extrude_import5(), rt_metaball_import5(), rt_nmg_idisk(), rt_nmg_import5(), rt_nmg_import_fastf(), rt_nmg_import_internal(), rt_nurb_import5(), rt_pipe_import(), rt_pipe_import5(), rt_sketch_import(), rt_sketch_import5(), and rt_vlist_import().

unsigned char * bu_pshort register unsigned char *  msgp,
register int  s
 

B U _ P S H O R T

Definition at line 104 of file xdr.c.

Referenced by db5_encode_length(), and rt_dsp_export5().

unsigned char* bu_plong register unsigned char *  msgp,
register unsigned long  l
 

Referenced by db5_encode_length(), rt_arbn_export(), rt_arbn_export5(), rt_ars_export5(), rt_binunif_export5(), rt_bot_export(), rt_bot_export5(), rt_dsp_export5(), rt_extrude_export(), rt_extrude_export5(), rt_metaball_export5(), rt_nmg_edisk(), rt_nmg_export_fastf(), rt_pipe_export(), rt_pipe_export5(), rt_sketch_export5(), and rt_vlist_export().

void htond register unsigned char *  out,
register const unsigned char *  in,
int  count
 

Host to Network Doubles.

H T O N D

Definition at line 108 of file htond.c.

References bcopy, and SIZEOF_NETWORK_DOUBLE.

void ntohd register unsigned char *  out,
register const unsigned char *  in,
int  count
 

Network to Host Doubles.

N T O H D

Definition at line 430 of file htond.c.

References bcopy, bu_bomb(), and SIZEOF_NETWORK_DOUBLE.

Here is the call graph for this function:

void htonf register unsigned char *  out,
register const unsigned char *  in,
int  count
 

H T O N F

Host to Network Floats

Definition at line 61 of file htonf.c.

References bcopy, and SIZEOF_NETWORK_FLOAT.

void ntohf register unsigned char *  out,
register const unsigned char *  in,
int  count
 

N T O H F

Network to Host Floats

Definition at line 106 of file htonf.c.

References bcopy, bu_bomb(), and SIZEOF_NETWORK_FLOAT.

Here is the call graph for this function:

unsigned char* bu_plong register unsigned char *  msgp,
register long unsigned int  l
 

B U _ P L O N G

Definition at line 116 of file xdr.c.


Generated on Mon Sep 18 01:25:19 2006 for BRL-CAD by  doxygen 1.4.6