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_TensorEm/Uint32Rect.h"
20 #include "b_BasicEm/Functions.h"
21 #include "b_BasicEm/Math.h"
22 #include "b_BasicEm/Memory.h"
23 
24 /* ------------------------------------------------------------------------- */
25 
26 /* ========================================================================= */
27 /*                                                                           */
28 /* ---- \ghd{ auxiliary functions } ---------------------------------------- */
29 /*                                                                           */
30 /* ========================================================================= */
31 
32 /* ------------------------------------------------------------------------- */
33 
34 /* ========================================================================= */
35 /*                                                                           */
36 /* ---- \ghd{ constructor / destructor } ----------------------------------- */
37 /*                                                                           */
38 /* ========================================================================= */
39 
40 /* ------------------------------------------------------------------------- */
41 
42 /* ========================================================================= */
43 /*                                                                           */
44 /* ---- \ghd{ operators } -------------------------------------------------- */
45 /*                                                                           */
46 /* ========================================================================= */
47 
48 /* ------------------------------------------------------------------------- */
49 
50 /* ========================================================================= */
51 /*                                                                           */
52 /* ---- \ghd{ query functions } -------------------------------------------- */
53 /*                                                                           */
54 /* ========================================================================= */
55 
56 /* ------------------------------------------------------------------------- */
57 
58 /* ========================================================================= */
59 /*                                                                           */
60 /* ---- \ghd{ modify functions } ------------------------------------------- */
61 /*                                                                           */
62 /* ========================================================================= */
63 
64 /* ------------------------------------------------------------------------- */
65 
66 /* ========================================================================= */
67 /*                                                                           */
68 /* ---- \ghd{ I/O } -------------------------------------------------------- */
69 /*                                                                           */
70 /* ========================================================================= */
71 
72 /* ------------------------------------------------------------------------- */
73 
bts_Uint32Rect_memSize(struct bbs_Context * cpA,const struct bts_Uint32Rect * ptrA)74 uint32 bts_Uint32Rect_memSize( struct bbs_Context* cpA,
75 							   const struct bts_Uint32Rect *ptrA )
76 {
77 	return bbs_SIZEOF16( struct bts_Uint32Rect );
78 }
79 
80 /* ------------------------------------------------------------------------- */
81 
bts_Uint32Rect_memWrite(struct bbs_Context * cpA,const struct bts_Uint32Rect * ptrA,uint16 * memPtrA)82 uint32 bts_Uint32Rect_memWrite( struct bbs_Context* cpA,
83 							    const struct bts_Uint32Rect* ptrA,
84 								uint16* memPtrA )
85 {
86 	memPtrA += bbs_memWrite32( &ptrA->x1E, memPtrA );
87 	memPtrA += bbs_memWrite32( &ptrA->y1E, memPtrA );
88 	memPtrA += bbs_memWrite32( &ptrA->x2E, memPtrA );
89 	memPtrA += bbs_memWrite32( &ptrA->y2E, memPtrA );
90 	return bbs_SIZEOF16( *ptrA );
91 }
92 
93 /* ------------------------------------------------------------------------- */
94 
bts_Uint32Rect_memRead(struct bbs_Context * cpA,struct bts_Uint32Rect * ptrA,const uint16 * memPtrA)95 uint32 bts_Uint32Rect_memRead( struct bbs_Context* cpA,
96 							   struct bts_Uint32Rect* ptrA,
97 							   const uint16* memPtrA )
98 {
99 	if( bbs_Context_error( cpA ) ) return 0;
100 	memPtrA += bbs_memRead32( &ptrA->x1E, memPtrA );
101 	memPtrA += bbs_memRead32( &ptrA->y1E, memPtrA );
102 	memPtrA += bbs_memRead32( &ptrA->x2E, memPtrA );
103 	memPtrA += bbs_memRead32( &ptrA->y2E, memPtrA );
104 	return bbs_SIZEOF16( *ptrA );
105 }
106 
107 /* ------------------------------------------------------------------------- */
108 
109 /* ========================================================================= */
110 /*                                                                           */
111 /* ---- \ghd{ exec functions } --------------------------------------------- */
112 /*                                                                           */
113 /* ========================================================================= */
114 
115 /* ------------------------------------------------------------------------- */
116 
117 /* ========================================================================= */
118 
119 
120