plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

mach-swap.3 (2239B)


      1 .TH MACH-SWAP 3
      2 .SH NAME
      3 beswap2, beswap4, beswap8, beieeeftoa32, beieeeftoa64, beieeeftoa80,
      4 beload2, beload4, beload8,
      5 leswap2, leswap4, leswap8, leieeeftoa32, leieeeftoa64, leieeeftoa80,
      6 leload2, leload4, leload8, ieeeftoa32, ieeeftoa64 \- machine-independent access to byte-ordered data
      7 .SH SYNOPSIS
      8 .B #include <u.h>
      9 .br
     10 .B #include <libc.h>
     11 .br
     12 .B #include <mach.h>
     13 .PP
     14 .ta \w'\fBu64intxx'u
     15 .B
     16 u16int	beswap2(u16int u)
     17 .br
     18 u32int	beswap4(u32int u)
     19 .br
     20 u64int	beswap8(u64int u)
     21 .PP
     22 .B
     23 int	beieeeftoa32(char *a, uint n, void *f)
     24 .br
     25 int	beieeeftoa64(char *a, uint n, void *f)
     26 .br
     27 int	beieeeftoa80(char *a, uint n, void *f)
     28 .PP
     29 .B
     30 u16int	beload2(uchar *p)
     31 .br
     32 u32int	beload4(uchar *p)
     33 .br
     34 u64int	beload8(uchar *p)
     35 .PP
     36 .B
     37 u16int	leswap2(u16int u)
     38 .br
     39 u32int	leswap4(u32int u)
     40 .br
     41 u64int	leswap8(u64int u)
     42 .PP
     43 .B
     44 int	leieeeftoa32(char *a, uint n, void *f)
     45 .br
     46 int	leieeeftoa64(char *a, uint n, void *f)
     47 .br
     48 int	leieeeftoa80(char *a, uint n, void *f)
     49 .PP
     50 .B
     51 u16int	leload2(uchar *p)
     52 .br
     53 u32int	leload4(uchar *p)
     54 .br
     55 u64int	leload8(uchar *p)
     56 .PP
     57 .B
     58 int	ieeeftoa32(char *a, uint n, u32int u)
     59 .br
     60 int	ieeeftoa64(char *a, uint n, u32int hi, u32int lo)
     61 .SH DESCRIPTION
     62 These functions provide 
     63 machine-independent access to data in a particular byte order.
     64 .PP
     65 .IR Beswap2 ,
     66 .IR beswap4 ,
     67 and
     68 .I beswap8
     69 return the 2-byte, 4-byte, and 8-byte
     70 big-endian representation of the bytes in
     71 .IR val ,
     72 respectively.
     73 .PP
     74 .IR Beload2 ,
     75 .IR beload4 ,
     76 and
     77 .I beload8
     78 return the 2-byte, 4-byte, and 8-byte 
     79 big-endian interpretation of the bytes at
     80 .IR p ,
     81 respectively.
     82 .PP
     83 .IR Beieeeftoa32 ,
     84 .IR beieeeftoa64 ,
     85 and
     86 .I beieeeftoa80
     87 format the big-endian 4-byte, 8-byte, or 10-byte IEEE floating-point value
     88 at
     89 .IR f
     90 into the 
     91 .IR n -byte 
     92 string buffer
     93 .IR a .
     94 .PP
     95 .IR Leswap2 ,
     96 .IR leswap4 ,
     97 etc. are the little-endian equivalents of the routines just described.
     98 .PP
     99 .I Ieeeftoa32
    100 and
    101 .I ieeeftoa64
    102 format a local machine byte-order floating-point value into the 
    103 .IR n -byte
    104 string buffer
    105 .IR a .
    106 .I Ieeeftoa32
    107 expects a 32-bit floating-point value stored in the bits of
    108 .IR u .
    109 .I Ieeeftoa64
    110 expects a 64-bit floating-point value whose high 32-bits are in 
    111 .I hi
    112 and low 32-bits are in
    113 .IR lo .
    114 .SH SOURCE
    115 .B \*9/src/libmach
    116 .SH "SEE ALSO"
    117 .MR mach (3)