UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
trans_int8.h
1 /* trans_int8.h */
2 /* $Id: trans_int8.h,v 1.2 2000/09/08 17:24:15 vlad Exp $ */
3 #ifndef __trans_int8_h
4 #define __trans_int8_h
5 
6 /***********************************************************************
7  *
8  * Module for 64-bit integer operations for non-64-bit compatible
9  * C/C++ compilers.
10  *
11  ***********************************************************************/
12 
13 #include <mix/Types.h>
14 
15 
16 /***********************************************************************
17  * Special type for 64-bit numbers operating via 32-bit operations.
18  ***********************************************************************/
19 typedef struct {
20  UnsInt4 part[2];
21 } UnsInt8_t;
22 
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
27 
28 
29 /***********************************************************************
30  * Set or unset given bit in 64-bit number. bit_no=0..63
31  ***********************************************************************/
32 void trans_int8_set_bit (UnsInt8_t* pi8, int bit_no, int bit_val);
33 
34 /***********************************************************************
35  * Get the value of given bit of 64-bit number. bit_no=0..63
36  ***********************************************************************/
37 int trans_int8_get_bit (UnsInt8_t* pi8, int bit_no);
38 
39 /***********************************************************************
40  * Masking the number (bits outside given range become 0).
41  ***********************************************************************/
42 void trans_int8_mask (UnsInt8_t* pi8, int bit1, int bit2);
43 
44 /***********************************************************************
45  * Shift the number by given count bits. Equivalent to multiplying by
46  * 2 in power of shift.
47  * shift < 0 means >>
48  * shift > 0 means <<
49  ***********************************************************************/
50 void trans_int8_shift (UnsInt8_t* pi8, int shift);
51 
52 
53 /***********************************************************************
54  * Transform 64-bit number to bytes. NULL pointers are allowed to
55  * give out of non-needed bytes.
56  ***********************************************************************/
57 void trans_int8_to_8b (UnsInt8_t* pi8,
58  int* b0, int* b1, int* b2, int* b3,
59  int* b4, int* b5, int* b6, int* b7);
60 
61 /***********************************************************************
62  * Transform 8 bytes to 64-bit number in special representation.
63  ***********************************************************************/
64 void trans_8b_to_int8 (UnsInt8_t* pi8,
65  int b0, int b1, int b2, int b3,
66  int b4, int b5, int b6, int b7);
67 
68 /***********************************************************************
69  * Transform 64-bit number to long words. NULL pointers are allowed to
70  * give out of non-needed bytes.
71  ***********************************************************************/
72 void trans_int8_to_2lw (UnsInt8_t* pi8, UnsInt4* lw0, UnsInt4* lw1);
73 
74 /***********************************************************************
75  * Transform two long words to 64-bit number in special representation.
76  ***********************************************************************/
77 void trans_2lw_to_int8 (UnsInt8_t* pi8, UnsInt4 lw0, UnsInt4 lw1);
78 
79 
80 #ifdef __cplusplus
81 };
82 #endif /* __cplusplus */
83 
84 #endif /* trans_int8.h */
Definition: trans_int8.h:19