1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /* ---- includes ----------------------------------------------------------- */
18 
19 #include "b_BasicEm/Functions.h"
20 #include "b_BitFeatureEm/BitParam.h"
21 
22 /* ------------------------------------------------------------------------- */
23 
24 /* ========================================================================= */
25 /*                                                                           */
26 /* ---- \ghd{ auxiliary functions } ---------------------------------------- */
27 /*                                                                           */
28 /* ========================================================================= */
29 
30 /* ------------------------------------------------------------------------- */
31 
32 /* ========================================================================= */
33 /*                                                                           */
34 /* ---- \ghd{ constructor / destructor } ----------------------------------- */
35 /*                                                                           */
36 /* ========================================================================= */
37 
38 /* ------------------------------------------------------------------------- */
39 
bbf_BitParam_init(struct bbs_Context * cpA,struct bbf_BitParam * ptrA)40 void bbf_BitParam_init( struct bbs_Context* cpA,
41 					    struct bbf_BitParam* ptrA )
42 {
43 	ptrA->innerRadiusE = 0;
44 	ptrA->outerRadiusE = 0;
45 }
46 
47 /* ------------------------------------------------------------------------- */
48 
bbf_BitParam_exit(struct bbs_Context * cpA,struct bbf_BitParam * ptrA)49 void bbf_BitParam_exit( struct bbs_Context* cpA,
50 						    struct bbf_BitParam* ptrA )
51 {
52 	ptrA->innerRadiusE = 0;
53 	ptrA->outerRadiusE = 0;
54 }
55 
56 /* ------------------------------------------------------------------------- */
57 
58 /* ========================================================================= */
59 /*                                                                           */
60 /* ---- \ghd{ operators } -------------------------------------------------- */
61 /*                                                                           */
62 /* ========================================================================= */
63 
64 /* ------------------------------------------------------------------------- */
65 
bbf_BitParam_copy(struct bbs_Context * cpA,struct bbf_BitParam * ptrA,const struct bbf_BitParam * srcPtrA)66 void bbf_BitParam_copy( struct bbs_Context* cpA,
67 					    struct bbf_BitParam* ptrA,
68 					    const struct bbf_BitParam* srcPtrA )
69 {
70 	ptrA->innerRadiusE = srcPtrA->innerRadiusE;
71 	ptrA->outerRadiusE = srcPtrA->outerRadiusE;
72 }
73 
74 /* ------------------------------------------------------------------------- */
75 
bbf_BitParam_equal(struct bbs_Context * cpA,const struct bbf_BitParam * ptrA,const struct bbf_BitParam * srcPtrA)76 flag bbf_BitParam_equal( struct bbs_Context* cpA,
77 					     const struct bbf_BitParam* ptrA,
78 					     const struct bbf_BitParam* srcPtrA )
79 {
80 	if( ptrA->innerRadiusE != srcPtrA->innerRadiusE ) return FALSE;
81 	if( ptrA->outerRadiusE != srcPtrA->outerRadiusE ) return FALSE;
82 	return TRUE;
83 }
84 
85 /* ------------------------------------------------------------------------- */
86 
87 /* ========================================================================= */
88 /*                                                                           */
89 /* ---- \ghd{ query functions } -------------------------------------------- */
90 /*                                                                           */
91 /* ========================================================================= */
92 
93 /* ------------------------------------------------------------------------- */
94 
95 /* ========================================================================= */
96 /*                                                                           */
97 /* ---- \ghd{ modify functions } ------------------------------------------- */
98 /*                                                                           */
99 /* ========================================================================= */
100 
101 /* ------------------------------------------------------------------------- */
102 
103 /* ========================================================================= */
104 /*                                                                           */
105 /* ---- \ghd{ I/O } -------------------------------------------------------- */
106 /*                                                                           */
107 /* ========================================================================= */
108 
109 /* ------------------------------------------------------------------------- */
110 
bbf_BitParam_memSize(struct bbs_Context * cpA,const struct bbf_BitParam * ptrA)111 uint32 bbf_BitParam_memSize( struct bbs_Context* cpA,
112 						     const struct bbf_BitParam* ptrA )
113 {
114 	uint32 memSizeL = 0;
115 	memSizeL += bbs_SIZEOF16( ptrA->innerRadiusE );
116 	memSizeL += bbs_SIZEOF16( ptrA->outerRadiusE );
117 	return memSizeL;
118 }
119 
120 /* ------------------------------------------------------------------------- */
121 
bbf_BitParam_memWrite(struct bbs_Context * cpA,const struct bbf_BitParam * ptrA,uint16 * memPtrA)122 uint32 bbf_BitParam_memWrite( struct bbs_Context* cpA,
123 						      const struct bbf_BitParam* ptrA,
124 							  uint16* memPtrA )
125 {
126 	memPtrA += bbs_memWrite32( &ptrA->innerRadiusE, memPtrA );
127 	memPtrA += bbs_memWrite32( &ptrA->outerRadiusE, memPtrA );
128 	return bbf_BitParam_memSize( cpA, ptrA );
129 }
130 
131 /* ------------------------------------------------------------------------- */
132 
bbf_BitParam_memRead(struct bbs_Context * cpA,struct bbf_BitParam * ptrA,const uint16 * memPtrA)133 uint32 bbf_BitParam_memRead( struct bbs_Context* cpA,
134 						     struct bbf_BitParam* ptrA,
135 						     const uint16* memPtrA )
136 {
137 	memPtrA += bbs_memRead32( &ptrA->innerRadiusE, memPtrA );
138 	memPtrA += bbs_memRead32( &ptrA->outerRadiusE, memPtrA );
139 	return bbf_BitParam_memSize( cpA, ptrA );
140 }
141 
142 /* ------------------------------------------------------------------------- */
143 
144 /* ========================================================================= */
145 /*                                                                           */
146 /* ---- \ghd{ exec functions } --------------------------------------------- */
147 /*                                                                           */
148 /* ========================================================================= */
149 
150 /* ------------------------------------------------------------------------- */
151 
152 /* ========================================================================= */
153 
154