Annotation of 43BSDReno/kerberosIV/include/lsb_addr_comp.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * $Source: /mit/kerberos/src/include/RCS/lsb_addr_comp.h,v $
                      3:  * $Author: jtkohl $
                      4:  * $Header: lsb_addr_comp.h,v 4.0 89/01/23 15:44:46 jtkohl Exp $
                      5:  *
                      6:  * Copyright 1988 by the Massachusetts Institute of Technology.
                      7:  *
                      8:  * For copying and distribution information, please see the file
                      9:  * <mit-copyright.h>.
                     10:  *
                     11:  * Comparison macros to emulate LSBFIRST comparison results of network
                     12:  * byte-order quantities
                     13:  */
                     14: 
                     15: #include <mit-copyright.h>
                     16: #ifndef LSB_ADDR_COMP_DEFS
                     17: #define LSB_ADDR_COMP_DEFS
                     18: 
                     19: #include "osconf.h"
                     20: 
                     21: #ifdef LSBFIRST
                     22: #define lsb_net_ulong_less(x,y) ((x < y) ? -1 : ((x > y) ? 1 : 0))
                     23: #define lsb_net_ushort_less(x,y) ((x < y) ? -1 : ((x > y) ? 1 : 0))
                     24: #else
                     25: /* MSBFIRST */
                     26: #define u_char_comp(x,y) \
                     27:         (((x)>(y))?(1):(((x)==(y))?(0):(-1)))
                     28: /* This is gross, but... */
                     29: #define lsb_net_ulong_less(x, y) long_less_than((u_char *)&x, (u_char *)&y)
                     30: #define lsb_net_ushort_less(x, y) short_less_than((u_char *)&x, (u_char *)&y)
                     31: 
                     32: #define long_less_than(x,y) \
                     33:         (u_char_comp((x)[3],(y)[3])?u_char_comp((x)[3],(y)[3]): \
                     34:         (u_char_comp((x)[2],(y)[2])?u_char_comp((x)[2],(y)[2]): \
                     35:          (u_char_comp((x)[1],(y)[1])?u_char_comp((x)[1],(y)[1]): \
                     36:           (u_char_comp((x)[0],(y)[0])))))
                     37: #define short_less_than(x,y) \
                     38:          (u_char_comp((x)[1],(y)[1])?u_char_comp((x)[1],(y)[1]): \
                     39:           (u_char_comp((x)[0],(y)[0])))
                     40: 
                     41: #endif /* LSBFIRST */
                     42: 
                     43: #endif /*  LSB_ADDR_COMP_DEFS */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.