]>
Commit | Line | Data |
---|---|---|
d7a09cb8 SB |
1 | /** @file\r |
2 | This library provides helper functions to prevent integer overflow during\r | |
3 | type conversion, addition, subtraction, and multiplication.\r | |
4 | \r | |
5 | Copyright (c) 2017, Microsoft Corporation\r | |
6 | \r | |
7 | All rights reserved.\r | |
8 | Redistribution and use in source and binary forms, with or without\r | |
9 | modification, are permitted provided that the following conditions are met:\r | |
10 | 1. Redistributions of source code must retain the above copyright notice,\r | |
11 | this list of conditions and the following disclaimer.\r | |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,\r | |
13 | this list of conditions and the following disclaimer in the documentation\r | |
14 | and/or other materials provided with the distribution.\r | |
15 | \r | |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\r | |
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r | |
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r | |
19 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r | |
20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r | |
21 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r | |
22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r | |
23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r | |
24 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r | |
25 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r | |
26 | \r | |
27 | **/\r | |
28 | #ifndef __INT_SAFE_LIB_H__\r | |
29 | #define __INT_SAFE_LIB_H__\r | |
30 | \r | |
31 | //\r | |
32 | // It is common for -1 to be used as an error value\r | |
33 | //\r | |
34 | #define INT8_ERROR ((INT8) -1)\r | |
35 | #define UINT8_ERROR MAX_UINT8\r | |
36 | #define CHAR8_ERROR ((CHAR8)(MAX_INT8))\r | |
37 | #define INT16_ERROR ((INT16) -1)\r | |
38 | #define UINT16_ERROR MAX_UINT16\r | |
39 | #define CHAR16_ERROR MAX_UINT16\r | |
40 | #define INT32_ERROR ((INT32) -1)\r | |
41 | #define UINT32_ERROR MAX_UINT32\r | |
42 | #define INT64_ERROR ((INT64) -1)\r | |
43 | #define UINT64_ERROR MAX_UINT64\r | |
44 | #define INTN_ERROR ((INTN) -1)\r | |
45 | #define UINTN_ERROR MAX_UINTN\r | |
46 | \r | |
47 | //\r | |
48 | // CHAR16 is defined to be the same as UINT16, so for CHAR16\r | |
49 | // operations redirect to the UINT16 ones:\r | |
50 | //\r | |
51 | #define SafeInt8ToChar16 SafeInt8ToUint16\r | |
52 | #define SafeInt16ToChar16 SafeInt16ToUint16\r | |
53 | #define SafeInt32ToChar16 SafeInt32ToUint16\r | |
54 | #define SafeUint32ToChar16 SafeUint32ToUint16\r | |
55 | #define SafeInt64ToChar16 SafeInt64ToUint16\r | |
56 | #define SafeUint64ToChar16 SafeUint64ToUint16\r | |
57 | #define SafeIntnToChar16 SafeIntnToUint16\r | |
58 | #define SafeUintnToChar16 SafeUintnToUint16\r | |
59 | \r | |
60 | #define SafeChar16ToInt8 SafeUint16ToInt8\r | |
61 | #define SafeChar16ToUint8 SafeUint16ToUint8\r | |
62 | #define SafeChar16ToChar8 SafeUint16ToChar8\r | |
63 | #define SafeChar16ToInt16 SafeUint16ToInt16\r | |
64 | \r | |
65 | #define SafeChar16Mult SafeUint16Mult\r | |
66 | #define SafeChar16Sub SafeUint16Sub\r | |
67 | #define SafeChar16Add SafeUint16Add\r | |
68 | \r | |
69 | //\r | |
70 | // Conversion functions\r | |
71 | //\r | |
72 | // There are three reasons for having conversion functions:\r | |
73 | //\r | |
74 | // 1. We are converting from a signed type to an unsigned type of the same\r | |
75 | // size, or vice-versa.\r | |
76 | //\r | |
77 | // 2. We are converting to a smaller type, and we could therefore possibly\r | |
78 | // overflow.\r | |
79 | //\r | |
80 | // 3. We are converting to a bigger type, and we are signed and the type we are\r | |
81 | // converting to is unsigned.\r | |
82 | //\r | |
83 | \r | |
84 | /**\r | |
85 | INT8 -> UINT8 conversion\r | |
86 | \r | |
87 | Converts the value specified by Operand to a value specified by Result type\r | |
88 | and stores the converted value into the caller allocated output buffer\r | |
89 | specified by Result. The caller must pass in a Result buffer that is at\r | |
90 | least as large as the Result type.\r | |
91 | \r | |
92 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
93 | \r | |
94 | If the conversion results in an overflow or an underflow condition, then\r | |
95 | Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
96 | \r | |
97 | @param[in] Operand Operand to be converted to new type\r | |
98 | @param[out] Result Pointer to the result of conversion\r | |
99 | \r | |
100 | @retval RETURN_SUCCESS Successful conversion\r | |
101 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
102 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
103 | **/\r | |
104 | RETURN_STATUS\r | |
105 | EFIAPI\r | |
106 | SafeInt8ToUint8 (\r | |
107 | IN INT8 Operand,\r | |
108 | OUT UINT8 *Result\r | |
109 | );\r | |
110 | \r | |
111 | /**\r | |
112 | INT8 -> CHAR8 conversion\r | |
113 | \r | |
114 | Converts the value specified by Operand to a value specified by Result type\r | |
115 | and stores the converted value into the caller allocated output buffer\r | |
116 | specified by Result. The caller must pass in a Result buffer that is at\r | |
117 | least as large as the Result type.\r | |
118 | \r | |
119 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
120 | \r | |
121 | If the conversion results in an overflow or an underflow condition, then\r | |
122 | Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
123 | \r | |
124 | @param[in] Operand Operand to be converted to new type\r | |
125 | @param[out] Result Pointer to the result of conversion\r | |
126 | \r | |
127 | @retval RETURN_SUCCESS Successful conversion\r | |
128 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
129 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
130 | **/\r | |
131 | RETURN_STATUS\r | |
132 | EFIAPI\r | |
133 | SafeInt8ToChar8 (\r | |
134 | IN INT8 Operand,\r | |
135 | OUT CHAR8 *Result\r | |
136 | );\r | |
137 | \r | |
138 | /**\r | |
139 | INT8 -> UINT16 conversion\r | |
140 | \r | |
141 | Converts the value specified by Operand to a value specified by Result type\r | |
142 | and stores the converted value into the caller allocated output buffer\r | |
143 | specified by Result. The caller must pass in a Result buffer that is at\r | |
144 | least as large as the Result type.\r | |
145 | \r | |
146 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
147 | \r | |
148 | If the conversion results in an overflow or an underflow condition, then\r | |
149 | Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
150 | \r | |
151 | @param[in] Operand Operand to be converted to new type\r | |
152 | @param[out] Result Pointer to the result of conversion\r | |
153 | \r | |
154 | @retval RETURN_SUCCESS Successful conversion\r | |
155 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
156 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
157 | **/\r | |
158 | RETURN_STATUS\r | |
159 | EFIAPI\r | |
160 | SafeInt8ToUint16 (\r | |
161 | IN INT8 Operand,\r | |
162 | OUT UINT16 *Result\r | |
163 | );\r | |
164 | \r | |
165 | /**\r | |
166 | INT8 -> UINT32 conversion\r | |
167 | \r | |
168 | Converts the value specified by Operand to a value specified by Result type\r | |
169 | and stores the converted value into the caller allocated output buffer\r | |
170 | specified by Result. The caller must pass in a Result buffer that is at\r | |
171 | least as large as the Result type.\r | |
172 | \r | |
173 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
174 | \r | |
175 | If the conversion results in an overflow or an underflow condition, then\r | |
176 | Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
177 | \r | |
178 | @param[in] Operand Operand to be converted to new type\r | |
179 | @param[out] Result Pointer to the result of conversion\r | |
180 | \r | |
181 | @retval RETURN_SUCCESS Successful conversion\r | |
182 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
183 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
184 | **/\r | |
185 | RETURN_STATUS\r | |
186 | EFIAPI\r | |
187 | SafeInt8ToUint32 (\r | |
188 | IN INT8 Operand,\r | |
189 | OUT UINT32 *Result\r | |
190 | );\r | |
191 | \r | |
192 | /**\r | |
193 | INT8 -> UINTN conversion\r | |
194 | \r | |
195 | Converts the value specified by Operand to a value specified by Result type\r | |
196 | and stores the converted value into the caller allocated output buffer\r | |
197 | specified by Result. The caller must pass in a Result buffer that is at\r | |
198 | least as large as the Result type.\r | |
199 | \r | |
200 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
201 | \r | |
202 | If the conversion results in an overflow or an underflow condition, then\r | |
203 | Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
204 | \r | |
205 | @param[in] Operand Operand to be converted to new type\r | |
206 | @param[out] Result Pointer to the result of conversion\r | |
207 | \r | |
208 | @retval RETURN_SUCCESS Successful conversion\r | |
209 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
210 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
211 | **/\r | |
212 | RETURN_STATUS\r | |
213 | EFIAPI\r | |
214 | SafeInt8ToUintn (\r | |
215 | IN INT8 Operand,\r | |
216 | OUT UINTN *Result\r | |
217 | );\r | |
218 | \r | |
219 | /**\r | |
220 | INT8 -> UINT64 conversion\r | |
221 | \r | |
222 | Converts the value specified by Operand to a value specified by Result type\r | |
223 | and stores the converted value into the caller allocated output buffer\r | |
224 | specified by Result. The caller must pass in a Result buffer that is at\r | |
225 | least as large as the Result type.\r | |
226 | \r | |
227 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
228 | \r | |
229 | If the conversion results in an overflow or an underflow condition, then\r | |
230 | Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
231 | \r | |
232 | @param[in] Operand Operand to be converted to new type\r | |
233 | @param[out] Result Pointer to the result of conversion\r | |
234 | \r | |
235 | @retval RETURN_SUCCESS Successful conversion\r | |
236 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
237 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
238 | **/\r | |
239 | RETURN_STATUS\r | |
240 | EFIAPI\r | |
241 | SafeInt8ToUint64 (\r | |
242 | IN INT8 Operand,\r | |
243 | OUT UINT64 *Result\r | |
244 | );\r | |
245 | \r | |
246 | /**\r | |
247 | UINT8 -> INT8 conversion\r | |
248 | \r | |
249 | Converts the value specified by Operand to a value specified by Result type\r | |
250 | and stores the converted value into the caller allocated output buffer\r | |
251 | specified by Result. The caller must pass in a Result buffer that is at\r | |
252 | least as large as the Result type.\r | |
253 | \r | |
254 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
255 | \r | |
256 | If the conversion results in an overflow or an underflow condition, then\r | |
257 | Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
258 | \r | |
259 | @param[in] Operand Operand to be converted to new type\r | |
260 | @param[out] Result Pointer to the result of conversion\r | |
261 | \r | |
262 | @retval RETURN_SUCCESS Successful conversion\r | |
263 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
264 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
265 | **/\r | |
266 | RETURN_STATUS\r | |
267 | EFIAPI\r | |
268 | SafeUint8ToInt8 (\r | |
269 | IN UINT8 Operand,\r | |
270 | OUT INT8 *Result\r | |
271 | );\r | |
272 | \r | |
273 | /**\r | |
274 | UINT8 -> CHAR8 conversion\r | |
275 | \r | |
276 | Converts the value specified by Operand to a value specified by Result type\r | |
277 | and stores the converted value into the caller allocated output buffer\r | |
278 | specified by Result. The caller must pass in a Result buffer that is at\r | |
279 | least as large as the Result type.\r | |
280 | \r | |
281 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
282 | \r | |
283 | If the conversion results in an overflow or an underflow condition, then\r | |
284 | Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
285 | \r | |
286 | @param[in] Operand Operand to be converted to new type\r | |
287 | @param[out] Result Pointer to the result of conversion\r | |
288 | \r | |
289 | @retval RETURN_SUCCESS Successful conversion\r | |
290 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
291 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
292 | **/\r | |
293 | RETURN_STATUS\r | |
294 | EFIAPI\r | |
295 | SafeUint8ToChar8 (\r | |
296 | IN UINT8 Operand,\r | |
297 | OUT CHAR8 *Result\r | |
298 | );\r | |
299 | \r | |
300 | /**\r | |
301 | INT16 -> INT8 conversion\r | |
302 | \r | |
303 | Converts the value specified by Operand to a value specified by Result type\r | |
304 | and stores the converted value into the caller allocated output buffer\r | |
305 | specified by Result. The caller must pass in a Result buffer that is at\r | |
306 | least as large as the Result type.\r | |
307 | \r | |
308 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
309 | \r | |
310 | If the conversion results in an overflow or an underflow condition, then\r | |
311 | Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
312 | \r | |
313 | @param[in] Operand Operand to be converted to new type\r | |
314 | @param[out] Result Pointer to the result of conversion\r | |
315 | \r | |
316 | @retval RETURN_SUCCESS Successful conversion\r | |
317 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
318 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
319 | **/\r | |
320 | RETURN_STATUS\r | |
321 | EFIAPI\r | |
322 | SafeInt16ToInt8 (\r | |
323 | IN INT16 Operand,\r | |
324 | OUT INT8 *Result\r | |
325 | );\r | |
326 | \r | |
327 | /**\r | |
328 | INT16 -> CHAR8 conversion\r | |
329 | \r | |
330 | Converts the value specified by Operand to a value specified by Result type\r | |
331 | and stores the converted value into the caller allocated output buffer\r | |
332 | specified by Result. The caller must pass in a Result buffer that is at\r | |
333 | least as large as the Result type.\r | |
334 | \r | |
335 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
336 | \r | |
337 | If the conversion results in an overflow or an underflow condition, then\r | |
338 | Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
339 | \r | |
340 | @param[in] Operand Operand to be converted to new type\r | |
341 | @param[out] Result Pointer to the result of conversion\r | |
342 | \r | |
343 | @retval RETURN_SUCCESS Successful conversion\r | |
344 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
345 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
346 | **/\r | |
347 | RETURN_STATUS\r | |
348 | EFIAPI\r | |
349 | SafeInt16ToChar8 (\r | |
350 | IN INT16 Operand,\r | |
351 | OUT CHAR8 *Result\r | |
352 | );\r | |
353 | \r | |
354 | /**\r | |
355 | INT16 -> UINT8 conversion\r | |
356 | \r | |
357 | Converts the value specified by Operand to a value specified by Result type\r | |
358 | and stores the converted value into the caller allocated output buffer\r | |
359 | specified by Result. The caller must pass in a Result buffer that is at\r | |
360 | least as large as the Result type.\r | |
361 | \r | |
362 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
363 | \r | |
364 | If the conversion results in an overflow or an underflow condition, then\r | |
365 | Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
366 | \r | |
367 | @param[in] Operand Operand to be converted to new type\r | |
368 | @param[out] Result Pointer to the result of conversion\r | |
369 | \r | |
370 | @retval RETURN_SUCCESS Successful conversion\r | |
371 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
372 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
373 | **/\r | |
374 | RETURN_STATUS\r | |
375 | EFIAPI\r | |
376 | SafeInt16ToUint8 (\r | |
377 | IN INT16 Operand,\r | |
93efab6d | 378 | OUT UINT8 *Result\r |
d7a09cb8 SB |
379 | );\r |
380 | \r | |
381 | /**\r | |
382 | INT16 -> UINT16 conversion\r | |
383 | \r | |
384 | Converts the value specified by Operand to a value specified by Result type\r | |
385 | and stores the converted value into the caller allocated output buffer\r | |
386 | specified by Result. The caller must pass in a Result buffer that is at\r | |
387 | least as large as the Result type.\r | |
388 | \r | |
389 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
390 | \r | |
391 | If the conversion results in an overflow or an underflow condition, then\r | |
392 | Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
393 | \r | |
394 | @param[in] Operand Operand to be converted to new type\r | |
395 | @param[out] Result Pointer to the result of conversion\r | |
396 | \r | |
397 | @retval RETURN_SUCCESS Successful conversion\r | |
398 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
399 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
400 | **/\r | |
401 | RETURN_STATUS\r | |
402 | EFIAPI\r | |
403 | SafeInt16ToUint16 (\r | |
404 | IN INT16 Operand,\r | |
405 | OUT UINT16 *Result\r | |
406 | );\r | |
407 | \r | |
408 | /**\r | |
409 | INT16 -> UINT32 conversion\r | |
410 | \r | |
411 | Converts the value specified by Operand to a value specified by Result type\r | |
412 | and stores the converted value into the caller allocated output buffer\r | |
413 | specified by Result. The caller must pass in a Result buffer that is at\r | |
414 | least as large as the Result type.\r | |
415 | \r | |
416 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
417 | \r | |
418 | If the conversion results in an overflow or an underflow condition, then\r | |
419 | Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
420 | \r | |
421 | @param[in] Operand Operand to be converted to new type\r | |
422 | @param[out] Result Pointer to the result of conversion\r | |
423 | \r | |
424 | @retval RETURN_SUCCESS Successful conversion\r | |
425 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
426 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
427 | **/\r | |
428 | RETURN_STATUS\r | |
429 | EFIAPI\r | |
430 | SafeInt16ToUint32 (\r | |
431 | IN INT16 Operand,\r | |
432 | OUT UINT32 *Result\r | |
433 | );\r | |
434 | \r | |
435 | /**\r | |
436 | INT16 -> UINTN conversion\r | |
437 | \r | |
438 | Converts the value specified by Operand to a value specified by Result type\r | |
439 | and stores the converted value into the caller allocated output buffer\r | |
440 | specified by Result. The caller must pass in a Result buffer that is at\r | |
441 | least as large as the Result type.\r | |
442 | \r | |
443 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
444 | \r | |
445 | If the conversion results in an overflow or an underflow condition, then\r | |
446 | Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
447 | \r | |
448 | @param[in] Operand Operand to be converted to new type\r | |
449 | @param[out] Result Pointer to the result of conversion\r | |
450 | \r | |
451 | @retval RETURN_SUCCESS Successful conversion\r | |
452 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
453 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
454 | **/\r | |
455 | RETURN_STATUS\r | |
456 | EFIAPI\r | |
457 | SafeInt16ToUintn (\r | |
458 | IN INT16 Operand,\r | |
459 | OUT UINTN *Result\r | |
460 | );\r | |
461 | \r | |
462 | /**\r | |
463 | INT16 -> UINT64 conversion\r | |
464 | \r | |
465 | Converts the value specified by Operand to a value specified by Result type\r | |
466 | and stores the converted value into the caller allocated output buffer\r | |
467 | specified by Result. The caller must pass in a Result buffer that is at\r | |
468 | least as large as the Result type.\r | |
469 | \r | |
470 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
471 | \r | |
472 | If the conversion results in an overflow or an underflow condition, then\r | |
473 | Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
474 | \r | |
475 | @param[in] Operand Operand to be converted to new type\r | |
476 | @param[out] Result Pointer to the result of conversion\r | |
477 | \r | |
478 | @retval RETURN_SUCCESS Successful conversion\r | |
479 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
480 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
481 | **/\r | |
482 | RETURN_STATUS\r | |
483 | EFIAPI\r | |
484 | SafeInt16ToUint64 (\r | |
485 | IN INT16 Operand,\r | |
486 | OUT UINT64 *Result\r | |
487 | );\r | |
488 | \r | |
489 | /**\r | |
490 | UINT16 -> INT8 conversion\r | |
491 | \r | |
492 | Converts the value specified by Operand to a value specified by Result type\r | |
493 | and stores the converted value into the caller allocated output buffer\r | |
494 | specified by Result. The caller must pass in a Result buffer that is at\r | |
495 | least as large as the Result type.\r | |
496 | \r | |
497 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
498 | \r | |
499 | If the conversion results in an overflow or an underflow condition, then\r | |
500 | Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
501 | \r | |
502 | @param[in] Operand Operand to be converted to new type\r | |
503 | @param[out] Result Pointer to the result of conversion\r | |
504 | \r | |
505 | @retval RETURN_SUCCESS Successful conversion\r | |
506 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
507 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
508 | **/\r | |
509 | RETURN_STATUS\r | |
510 | EFIAPI\r | |
511 | SafeUint16ToInt8 (\r | |
512 | IN UINT16 Operand,\r | |
513 | OUT INT8 *Result\r | |
514 | );\r | |
515 | \r | |
516 | /**\r | |
517 | UINT16 -> CHAR8 conversion\r | |
518 | \r | |
519 | Converts the value specified by Operand to a value specified by Result type\r | |
520 | and stores the converted value into the caller allocated output buffer\r | |
521 | specified by Result. The caller must pass in a Result buffer that is at\r | |
522 | least as large as the Result type.\r | |
523 | \r | |
524 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
525 | \r | |
526 | If the conversion results in an overflow or an underflow condition, then\r | |
527 | Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
528 | \r | |
529 | @param[in] Operand Operand to be converted to new type\r | |
530 | @param[out] Result Pointer to the result of conversion\r | |
531 | \r | |
532 | @retval RETURN_SUCCESS Successful conversion\r | |
533 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
534 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
535 | **/\r | |
536 | RETURN_STATUS\r | |
537 | EFIAPI\r | |
538 | SafeUint16ToChar8 (\r | |
539 | IN UINT16 Operand,\r | |
540 | OUT CHAR8 *Result\r | |
541 | );\r | |
542 | \r | |
543 | /**\r | |
544 | UINT16 -> UINT8 conversion\r | |
545 | \r | |
546 | Converts the value specified by Operand to a value specified by Result type\r | |
547 | and stores the converted value into the caller allocated output buffer\r | |
548 | specified by Result. The caller must pass in a Result buffer that is at\r | |
549 | least as large as the Result type.\r | |
550 | \r | |
551 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
552 | \r | |
553 | If the conversion results in an overflow or an underflow condition, then\r | |
554 | Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
555 | \r | |
556 | @param[in] Operand Operand to be converted to new type\r | |
557 | @param[out] Result Pointer to the result of conversion\r | |
558 | \r | |
559 | @retval RETURN_SUCCESS Successful conversion\r | |
560 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
561 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
562 | **/\r | |
563 | RETURN_STATUS\r | |
564 | EFIAPI\r | |
565 | SafeUint16ToUint8 (\r | |
566 | IN UINT16 Operand,\r | |
93efab6d | 567 | OUT UINT8 *Result\r |
d7a09cb8 SB |
568 | );\r |
569 | \r | |
570 | /**\r | |
571 | UINT16 -> INT16 conversion\r | |
572 | \r | |
573 | Converts the value specified by Operand to a value specified by Result type\r | |
574 | and stores the converted value into the caller allocated output buffer\r | |
575 | specified by Result. The caller must pass in a Result buffer that is at\r | |
576 | least as large as the Result type.\r | |
577 | \r | |
578 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
579 | \r | |
580 | If the conversion results in an overflow or an underflow condition, then\r | |
581 | Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
582 | \r | |
583 | @param[in] Operand Operand to be converted to new type\r | |
584 | @param[out] Result Pointer to the result of conversion\r | |
585 | \r | |
586 | @retval RETURN_SUCCESS Successful conversion\r | |
587 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
588 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
589 | **/\r | |
590 | RETURN_STATUS\r | |
591 | EFIAPI\r | |
592 | SafeUint16ToInt16 (\r | |
593 | IN UINT16 Operand,\r | |
594 | OUT INT16 *Result\r | |
595 | );\r | |
596 | \r | |
597 | /**\r | |
598 | INT32 -> INT8 conversion\r | |
599 | \r | |
600 | Converts the value specified by Operand to a value specified by Result type\r | |
601 | and stores the converted value into the caller allocated output buffer\r | |
602 | specified by Result. The caller must pass in a Result buffer that is at\r | |
603 | least as large as the Result type.\r | |
604 | \r | |
605 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
606 | \r | |
607 | If the conversion results in an overflow or an underflow condition, then\r | |
608 | Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
609 | \r | |
610 | @param[in] Operand Operand to be converted to new type\r | |
611 | @param[out] Result Pointer to the result of conversion\r | |
612 | \r | |
613 | @retval RETURN_SUCCESS Successful conversion\r | |
614 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
615 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
616 | **/\r | |
617 | RETURN_STATUS\r | |
618 | EFIAPI\r | |
619 | SafeInt32ToInt8 (\r | |
620 | IN INT32 Operand,\r | |
621 | OUT INT8 *Result\r | |
622 | );\r | |
623 | \r | |
624 | /**\r | |
625 | INT32 -> CHAR8 conversion\r | |
626 | \r | |
627 | Converts the value specified by Operand to a value specified by Result type\r | |
628 | and stores the converted value into the caller allocated output buffer\r | |
629 | specified by Result. The caller must pass in a Result buffer that is at\r | |
630 | least as large as the Result type.\r | |
631 | \r | |
632 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
633 | \r | |
634 | If the conversion results in an overflow or an underflow condition, then\r | |
635 | Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
636 | \r | |
637 | @param[in] Operand Operand to be converted to new type\r | |
638 | @param[out] Result Pointer to the result of conversion\r | |
639 | \r | |
640 | @retval RETURN_SUCCESS Successful conversion\r | |
641 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
642 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
643 | **/\r | |
644 | RETURN_STATUS\r | |
645 | EFIAPI\r | |
646 | SafeInt32ToChar8 (\r | |
647 | IN INT32 Operand,\r | |
648 | OUT CHAR8 *Result\r | |
649 | );\r | |
650 | \r | |
651 | /**\r | |
652 | INT32 -> UINT8 conversion\r | |
653 | \r | |
654 | Converts the value specified by Operand to a value specified by Result type\r | |
655 | and stores the converted value into the caller allocated output buffer\r | |
656 | specified by Result. The caller must pass in a Result buffer that is at\r | |
657 | least as large as the Result type.\r | |
658 | \r | |
659 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
660 | \r | |
661 | If the conversion results in an overflow or an underflow condition, then\r | |
662 | Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
663 | \r | |
664 | @param[in] Operand Operand to be converted to new type\r | |
665 | @param[out] Result Pointer to the result of conversion\r | |
666 | \r | |
667 | @retval RETURN_SUCCESS Successful conversion\r | |
668 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
669 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
670 | **/\r | |
671 | RETURN_STATUS\r | |
672 | EFIAPI\r | |
673 | SafeInt32ToUint8 (\r | |
674 | IN INT32 Operand,\r | |
93efab6d | 675 | OUT UINT8 *Result\r |
d7a09cb8 SB |
676 | );\r |
677 | \r | |
678 | /**\r | |
679 | INT32 -> INT16 conversion\r | |
680 | \r | |
681 | Converts the value specified by Operand to a value specified by Result type\r | |
682 | and stores the converted value into the caller allocated output buffer\r | |
683 | specified by Result. The caller must pass in a Result buffer that is at\r | |
684 | least as large as the Result type.\r | |
685 | \r | |
686 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
687 | \r | |
688 | If the conversion results in an overflow or an underflow condition, then\r | |
689 | Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
690 | \r | |
691 | @param[in] Operand Operand to be converted to new type\r | |
692 | @param[out] Result Pointer to the result of conversion\r | |
693 | \r | |
694 | @retval RETURN_SUCCESS Successful conversion\r | |
695 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
696 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
697 | **/\r | |
698 | RETURN_STATUS\r | |
699 | EFIAPI\r | |
700 | SafeInt32ToInt16 (\r | |
701 | IN INT32 Operand,\r | |
702 | OUT INT16 *Result\r | |
703 | );\r | |
704 | \r | |
705 | /**\r | |
706 | INT32 -> UINT16 conversion\r | |
707 | \r | |
708 | Converts the value specified by Operand to a value specified by Result type\r | |
709 | and stores the converted value into the caller allocated output buffer\r | |
710 | specified by Result. The caller must pass in a Result buffer that is at\r | |
711 | least as large as the Result type.\r | |
712 | \r | |
713 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
714 | \r | |
715 | If the conversion results in an overflow or an underflow condition, then\r | |
716 | Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
717 | \r | |
718 | @param[in] Operand Operand to be converted to new type\r | |
719 | @param[out] Result Pointer to the result of conversion\r | |
720 | \r | |
721 | @retval RETURN_SUCCESS Successful conversion\r | |
722 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
723 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
724 | **/\r | |
725 | RETURN_STATUS\r | |
726 | EFIAPI\r | |
727 | SafeInt32ToUint16 (\r | |
728 | IN INT32 Operand,\r | |
729 | OUT UINT16 *Result\r | |
730 | );\r | |
731 | \r | |
732 | \r | |
733 | /**\r | |
734 | INT32 -> UINT32 conversion\r | |
735 | \r | |
736 | Converts the value specified by Operand to a value specified by Result type\r | |
737 | and stores the converted value into the caller allocated output buffer\r | |
738 | specified by Result. The caller must pass in a Result buffer that is at\r | |
739 | least as large as the Result type.\r | |
740 | \r | |
741 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
742 | \r | |
743 | If the conversion results in an overflow or an underflow condition, then\r | |
744 | Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
745 | \r | |
746 | @param[in] Operand Operand to be converted to new type\r | |
747 | @param[out] Result Pointer to the result of conversion\r | |
748 | \r | |
749 | @retval RETURN_SUCCESS Successful conversion\r | |
750 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
751 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
752 | **/\r | |
753 | RETURN_STATUS\r | |
754 | EFIAPI\r | |
755 | SafeInt32ToUint32 (\r | |
756 | IN INT32 Operand,\r | |
757 | OUT UINT32 *Result\r | |
758 | );\r | |
759 | \r | |
760 | /**\r | |
761 | INT32 -> UINTN conversion\r | |
762 | \r | |
763 | Converts the value specified by Operand to a value specified by Result type\r | |
764 | and stores the converted value into the caller allocated output buffer\r | |
765 | specified by Result. The caller must pass in a Result buffer that is at\r | |
766 | least as large as the Result type.\r | |
767 | \r | |
768 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
769 | \r | |
770 | If the conversion results in an overflow or an underflow condition, then\r | |
771 | Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
772 | \r | |
773 | @param[in] Operand Operand to be converted to new type\r | |
774 | @param[out] Result Pointer to the result of conversion\r | |
775 | \r | |
776 | @retval RETURN_SUCCESS Successful conversion\r | |
777 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
778 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
779 | **/\r | |
780 | RETURN_STATUS\r | |
781 | EFIAPI\r | |
782 | SafeInt32ToUintn (\r | |
783 | IN INT32 Operand,\r | |
784 | OUT UINTN *Result\r | |
785 | );\r | |
786 | \r | |
787 | /**\r | |
788 | INT32 -> UINT64 conversion\r | |
789 | \r | |
790 | Converts the value specified by Operand to a value specified by Result type\r | |
791 | and stores the converted value into the caller allocated output buffer\r | |
792 | specified by Result. The caller must pass in a Result buffer that is at\r | |
793 | least as large as the Result type.\r | |
794 | \r | |
795 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
796 | \r | |
797 | If the conversion results in an overflow or an underflow condition, then\r | |
798 | Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
799 | \r | |
800 | @param[in] Operand Operand to be converted to new type\r | |
801 | @param[out] Result Pointer to the result of conversion\r | |
802 | \r | |
803 | @retval RETURN_SUCCESS Successful conversion\r | |
804 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
805 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
806 | **/\r | |
807 | RETURN_STATUS\r | |
808 | EFIAPI\r | |
809 | SafeInt32ToUint64 (\r | |
810 | IN INT32 Operand,\r | |
811 | OUT UINT64 *Result\r | |
812 | );\r | |
813 | \r | |
814 | /**\r | |
815 | UINT32 -> INT8 conversion\r | |
816 | \r | |
817 | Converts the value specified by Operand to a value specified by Result type\r | |
818 | and stores the converted value into the caller allocated output buffer\r | |
819 | specified by Result. The caller must pass in a Result buffer that is at\r | |
820 | least as large as the Result type.\r | |
821 | \r | |
822 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
823 | \r | |
824 | If the conversion results in an overflow or an underflow condition, then\r | |
825 | Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
826 | \r | |
827 | @param[in] Operand Operand to be converted to new type\r | |
828 | @param[out] Result Pointer to the result of conversion\r | |
829 | \r | |
830 | @retval RETURN_SUCCESS Successful conversion\r | |
831 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
832 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
833 | **/\r | |
834 | RETURN_STATUS\r | |
835 | EFIAPI\r | |
836 | SafeUint32ToInt8 (\r | |
837 | IN UINT32 Operand,\r | |
838 | OUT INT8 *Result\r | |
839 | );\r | |
840 | \r | |
841 | /**\r | |
842 | UINT32 -> CHAR8 conversion\r | |
843 | \r | |
844 | Converts the value specified by Operand to a value specified by Result type\r | |
845 | and stores the converted value into the caller allocated output buffer\r | |
846 | specified by Result. The caller must pass in a Result buffer that is at\r | |
847 | least as large as the Result type.\r | |
848 | \r | |
849 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
850 | \r | |
851 | If the conversion results in an overflow or an underflow condition, then\r | |
852 | Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
853 | \r | |
854 | @param[in] Operand Operand to be converted to new type\r | |
855 | @param[out] Result Pointer to the result of conversion\r | |
856 | \r | |
857 | @retval RETURN_SUCCESS Successful conversion\r | |
858 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
859 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
860 | **/\r | |
861 | RETURN_STATUS\r | |
862 | EFIAPI\r | |
863 | SafeUint32ToChar8 (\r | |
864 | IN UINT32 Operand,\r | |
865 | OUT CHAR8 *Result\r | |
866 | );\r | |
867 | \r | |
868 | /**\r | |
869 | UINT32 -> UINT8 conversion\r | |
870 | \r | |
871 | Converts the value specified by Operand to a value specified by Result type\r | |
872 | and stores the converted value into the caller allocated output buffer\r | |
873 | specified by Result. The caller must pass in a Result buffer that is at\r | |
874 | least as large as the Result type.\r | |
875 | \r | |
876 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
877 | \r | |
878 | If the conversion results in an overflow or an underflow condition, then\r | |
879 | Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
880 | \r | |
881 | @param[in] Operand Operand to be converted to new type\r | |
882 | @param[out] Result Pointer to the result of conversion\r | |
883 | \r | |
884 | @retval RETURN_SUCCESS Successful conversion\r | |
885 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
886 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
887 | **/\r | |
888 | RETURN_STATUS\r | |
889 | EFIAPI\r | |
890 | SafeUint32ToUint8 (\r | |
891 | IN UINT32 Operand,\r | |
93efab6d | 892 | OUT UINT8 *Result\r |
d7a09cb8 SB |
893 | );\r |
894 | \r | |
895 | /**\r | |
896 | UINT32 -> INT16 conversion\r | |
897 | \r | |
898 | Converts the value specified by Operand to a value specified by Result type\r | |
899 | and stores the converted value into the caller allocated output buffer\r | |
900 | specified by Result. The caller must pass in a Result buffer that is at\r | |
901 | least as large as the Result type.\r | |
902 | \r | |
903 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
904 | \r | |
905 | If the conversion results in an overflow or an underflow condition, then\r | |
906 | Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
907 | \r | |
908 | @param[in] Operand Operand to be converted to new type\r | |
909 | @param[out] Result Pointer to the result of conversion\r | |
910 | \r | |
911 | @retval RETURN_SUCCESS Successful conversion\r | |
912 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
913 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
914 | **/\r | |
915 | RETURN_STATUS\r | |
916 | EFIAPI\r | |
917 | SafeUint32ToInt16 (\r | |
918 | IN UINT32 Operand,\r | |
919 | OUT INT16 *Result\r | |
920 | );\r | |
921 | \r | |
922 | /**\r | |
923 | UINT32 -> UINT16 conversion\r | |
924 | \r | |
925 | Converts the value specified by Operand to a value specified by Result type\r | |
926 | and stores the converted value into the caller allocated output buffer\r | |
927 | specified by Result. The caller must pass in a Result buffer that is at\r | |
928 | least as large as the Result type.\r | |
929 | \r | |
930 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
931 | \r | |
932 | If the conversion results in an overflow or an underflow condition, then\r | |
933 | Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
934 | \r | |
935 | @param[in] Operand Operand to be converted to new type\r | |
936 | @param[out] Result Pointer to the result of conversion\r | |
937 | \r | |
938 | @retval RETURN_SUCCESS Successful conversion\r | |
939 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
940 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
941 | **/\r | |
942 | RETURN_STATUS\r | |
943 | EFIAPI\r | |
944 | SafeUint32ToUint16 (\r | |
945 | IN UINT32 Operand,\r | |
946 | OUT UINT16 *Result\r | |
947 | );\r | |
948 | \r | |
949 | /**\r | |
950 | UINT32 -> INT32 conversion\r | |
951 | \r | |
952 | Converts the value specified by Operand to a value specified by Result type\r | |
953 | and stores the converted value into the caller allocated output buffer\r | |
954 | specified by Result. The caller must pass in a Result buffer that is at\r | |
955 | least as large as the Result type.\r | |
956 | \r | |
957 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
958 | \r | |
959 | If the conversion results in an overflow or an underflow condition, then\r | |
960 | Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
961 | \r | |
962 | @param[in] Operand Operand to be converted to new type\r | |
963 | @param[out] Result Pointer to the result of conversion\r | |
964 | \r | |
965 | @retval RETURN_SUCCESS Successful conversion\r | |
966 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
967 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
968 | **/\r | |
969 | RETURN_STATUS\r | |
970 | EFIAPI\r | |
971 | SafeUint32ToInt32 (\r | |
972 | IN UINT32 Operand,\r | |
973 | OUT INT32 *Result\r | |
974 | );\r | |
975 | \r | |
976 | /**\r | |
977 | UINT32 -> INTN conversion\r | |
978 | \r | |
979 | Converts the value specified by Operand to a value specified by Result type\r | |
980 | and stores the converted value into the caller allocated output buffer\r | |
981 | specified by Result. The caller must pass in a Result buffer that is at\r | |
982 | least as large as the Result type.\r | |
983 | \r | |
984 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
985 | \r | |
986 | If the conversion results in an overflow or an underflow condition, then\r | |
987 | Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
988 | \r | |
989 | @param[in] Operand Operand to be converted to new type\r | |
990 | @param[out] Result Pointer to the result of conversion\r | |
991 | \r | |
992 | @retval RETURN_SUCCESS Successful conversion\r | |
993 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
994 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
995 | **/\r | |
996 | RETURN_STATUS\r | |
997 | EFIAPI\r | |
998 | SafeUint32ToIntn (\r | |
999 | IN UINT32 Operand,\r | |
1000 | OUT INTN *Result\r | |
1001 | );\r | |
1002 | \r | |
1003 | /**\r | |
1004 | INTN -> INT8 conversion\r | |
1005 | \r | |
1006 | Converts the value specified by Operand to a value specified by Result type\r | |
1007 | and stores the converted value into the caller allocated output buffer\r | |
1008 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1009 | least as large as the Result type.\r | |
1010 | \r | |
1011 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1012 | \r | |
1013 | If the conversion results in an overflow or an underflow condition, then\r | |
1014 | Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1015 | \r | |
1016 | @param[in] Operand Operand to be converted to new type\r | |
1017 | @param[out] Result Pointer to the result of conversion\r | |
1018 | \r | |
1019 | @retval RETURN_SUCCESS Successful conversion\r | |
1020 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1021 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1022 | **/\r | |
1023 | RETURN_STATUS\r | |
1024 | EFIAPI\r | |
1025 | SafeIntnToInt8 (\r | |
1026 | IN INTN Operand,\r | |
1027 | OUT INT8 *Result\r | |
1028 | );\r | |
1029 | \r | |
1030 | /**\r | |
1031 | INTN -> CHAR8 conversion\r | |
1032 | \r | |
1033 | Converts the value specified by Operand to a value specified by Result type\r | |
1034 | and stores the converted value into the caller allocated output buffer\r | |
1035 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1036 | least as large as the Result type.\r | |
1037 | \r | |
1038 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1039 | \r | |
1040 | If the conversion results in an overflow or an underflow condition, then\r | |
1041 | Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1042 | \r | |
1043 | @param[in] Operand Operand to be converted to new type\r | |
1044 | @param[out] Result Pointer to the result of conversion\r | |
1045 | \r | |
1046 | @retval RETURN_SUCCESS Successful conversion\r | |
1047 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1048 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1049 | **/\r | |
1050 | RETURN_STATUS\r | |
1051 | EFIAPI\r | |
1052 | SafeIntnToChar8 (\r | |
1053 | IN INTN Operand,\r | |
1054 | OUT CHAR8 *Result\r | |
1055 | );\r | |
1056 | \r | |
1057 | /**\r | |
1058 | INTN -> UINT8 conversion\r | |
1059 | \r | |
1060 | Converts the value specified by Operand to a value specified by Result type\r | |
1061 | and stores the converted value into the caller allocated output buffer\r | |
1062 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1063 | least as large as the Result type.\r | |
1064 | \r | |
1065 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1066 | \r | |
1067 | If the conversion results in an overflow or an underflow condition, then\r | |
1068 | Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1069 | \r | |
1070 | @param[in] Operand Operand to be converted to new type\r | |
1071 | @param[out] Result Pointer to the result of conversion\r | |
1072 | \r | |
1073 | @retval RETURN_SUCCESS Successful conversion\r | |
1074 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1075 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1076 | **/\r | |
1077 | RETURN_STATUS\r | |
1078 | EFIAPI\r | |
1079 | SafeIntnToUint8 (\r | |
1080 | IN INTN Operand,\r | |
93efab6d | 1081 | OUT UINT8 *Result\r |
d7a09cb8 SB |
1082 | );\r |
1083 | \r | |
1084 | /**\r | |
1085 | INTN -> INT16 conversion\r | |
1086 | \r | |
1087 | Converts the value specified by Operand to a value specified by Result type\r | |
1088 | and stores the converted value into the caller allocated output buffer\r | |
1089 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1090 | least as large as the Result type.\r | |
1091 | \r | |
1092 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1093 | \r | |
1094 | If the conversion results in an overflow or an underflow condition, then\r | |
1095 | Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1096 | \r | |
1097 | @param[in] Operand Operand to be converted to new type\r | |
1098 | @param[out] Result Pointer to the result of conversion\r | |
1099 | \r | |
1100 | @retval RETURN_SUCCESS Successful conversion\r | |
1101 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1102 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1103 | **/\r | |
1104 | RETURN_STATUS\r | |
1105 | EFIAPI\r | |
1106 | SafeIntnToInt16 (\r | |
1107 | IN INTN Operand,\r | |
1108 | OUT INT16 *Result\r | |
1109 | );\r | |
1110 | \r | |
1111 | /**\r | |
1112 | INTN -> UINT16 conversion\r | |
1113 | \r | |
1114 | Converts the value specified by Operand to a value specified by Result type\r | |
1115 | and stores the converted value into the caller allocated output buffer\r | |
1116 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1117 | least as large as the Result type.\r | |
1118 | \r | |
1119 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1120 | \r | |
1121 | If the conversion results in an overflow or an underflow condition, then\r | |
1122 | Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1123 | \r | |
1124 | @param[in] Operand Operand to be converted to new type\r | |
1125 | @param[out] Result Pointer to the result of conversion\r | |
1126 | \r | |
1127 | @retval RETURN_SUCCESS Successful conversion\r | |
1128 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1129 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1130 | **/\r | |
1131 | RETURN_STATUS\r | |
1132 | EFIAPI\r | |
1133 | SafeIntnToUint16 (\r | |
1134 | IN INTN Operand,\r | |
1135 | OUT UINT16 *Result\r | |
1136 | );\r | |
1137 | \r | |
1138 | /**\r | |
1139 | INTN -> INT32 conversion\r | |
1140 | \r | |
1141 | Converts the value specified by Operand to a value specified by Result type\r | |
1142 | and stores the converted value into the caller allocated output buffer\r | |
1143 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1144 | least as large as the Result type.\r | |
1145 | \r | |
1146 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1147 | \r | |
1148 | If the conversion results in an overflow or an underflow condition, then\r | |
1149 | Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1150 | \r | |
1151 | @param[in] Operand Operand to be converted to new type\r | |
1152 | @param[out] Result Pointer to the result of conversion\r | |
1153 | \r | |
1154 | @retval RETURN_SUCCESS Successful conversion\r | |
1155 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1156 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1157 | **/\r | |
1158 | RETURN_STATUS\r | |
1159 | EFIAPI\r | |
1160 | SafeIntnToInt32 (\r | |
1161 | IN INTN Operand,\r | |
1162 | OUT INT32 *Result\r | |
1163 | );\r | |
1164 | \r | |
1165 | /**\r | |
1166 | INTN -> UINT32 conversion\r | |
1167 | \r | |
1168 | Converts the value specified by Operand to a value specified by Result type\r | |
1169 | and stores the converted value into the caller allocated output buffer\r | |
1170 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1171 | least as large as the Result type.\r | |
1172 | \r | |
1173 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1174 | \r | |
1175 | If the conversion results in an overflow or an underflow condition, then\r | |
1176 | Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1177 | \r | |
1178 | @param[in] Operand Operand to be converted to new type\r | |
1179 | @param[out] Result Pointer to the result of conversion\r | |
1180 | \r | |
1181 | @retval RETURN_SUCCESS Successful conversion\r | |
1182 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1183 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1184 | **/\r | |
1185 | RETURN_STATUS\r | |
1186 | EFIAPI\r | |
1187 | SafeIntnToUint32 (\r | |
1188 | IN INTN Operand,\r | |
1189 | OUT UINT32 *Result\r | |
1190 | );\r | |
1191 | \r | |
1192 | /**\r | |
1193 | INTN -> UINTN conversion\r | |
1194 | \r | |
1195 | Converts the value specified by Operand to a value specified by Result type\r | |
1196 | and stores the converted value into the caller allocated output buffer\r | |
1197 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1198 | least as large as the Result type.\r | |
1199 | \r | |
1200 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1201 | \r | |
1202 | If the conversion results in an overflow or an underflow condition, then\r | |
1203 | Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1204 | \r | |
1205 | @param[in] Operand Operand to be converted to new type\r | |
1206 | @param[out] Result Pointer to the result of conversion\r | |
1207 | \r | |
1208 | @retval RETURN_SUCCESS Successful conversion\r | |
1209 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1210 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1211 | **/\r | |
1212 | RETURN_STATUS\r | |
1213 | EFIAPI\r | |
1214 | SafeIntnToUintn (\r | |
1215 | IN INTN Operand,\r | |
1216 | OUT UINTN *Result\r | |
1217 | );\r | |
1218 | \r | |
1219 | /**\r | |
1220 | INTN -> UINT64 conversion\r | |
1221 | \r | |
1222 | Converts the value specified by Operand to a value specified by Result type\r | |
1223 | and stores the converted value into the caller allocated output buffer\r | |
1224 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1225 | least as large as the Result type.\r | |
1226 | \r | |
1227 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1228 | \r | |
1229 | If the conversion results in an overflow or an underflow condition, then\r | |
1230 | Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1231 | \r | |
1232 | @param[in] Operand Operand to be converted to new type\r | |
1233 | @param[out] Result Pointer to the result of conversion\r | |
1234 | \r | |
1235 | @retval RETURN_SUCCESS Successful conversion\r | |
1236 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1237 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1238 | **/\r | |
1239 | RETURN_STATUS\r | |
1240 | EFIAPI\r | |
1241 | SafeIntnToUint64 (\r | |
1242 | IN INTN Operand,\r | |
1243 | OUT UINT64 *Result\r | |
1244 | );\r | |
1245 | \r | |
1246 | /**\r | |
1247 | UINTN -> INT8 conversion\r | |
1248 | \r | |
1249 | Converts the value specified by Operand to a value specified by Result type\r | |
1250 | and stores the converted value into the caller allocated output buffer\r | |
1251 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1252 | least as large as the Result type.\r | |
1253 | \r | |
1254 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1255 | \r | |
1256 | If the conversion results in an overflow or an underflow condition, then\r | |
1257 | Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1258 | \r | |
1259 | @param[in] Operand Operand to be converted to new type\r | |
1260 | @param[out] Result Pointer to the result of conversion\r | |
1261 | \r | |
1262 | @retval RETURN_SUCCESS Successful conversion\r | |
1263 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1264 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1265 | **/\r | |
1266 | RETURN_STATUS\r | |
1267 | EFIAPI\r | |
1268 | SafeUintnToInt8 (\r | |
1269 | IN UINTN Operand,\r | |
1270 | OUT INT8 *Result\r | |
1271 | );\r | |
1272 | \r | |
1273 | /**\r | |
1274 | UINTN -> CHAR8 conversion\r | |
1275 | \r | |
1276 | Converts the value specified by Operand to a value specified by Result type\r | |
1277 | and stores the converted value into the caller allocated output buffer\r | |
1278 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1279 | least as large as the Result type.\r | |
1280 | \r | |
1281 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1282 | \r | |
1283 | If the conversion results in an overflow or an underflow condition, then\r | |
1284 | Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1285 | \r | |
1286 | @param[in] Operand Operand to be converted to new type\r | |
1287 | @param[out] Result Pointer to the result of conversion\r | |
1288 | \r | |
1289 | @retval RETURN_SUCCESS Successful conversion\r | |
1290 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1291 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1292 | **/\r | |
1293 | RETURN_STATUS\r | |
1294 | EFIAPI\r | |
1295 | SafeUintnToChar8 (\r | |
1296 | IN UINTN Operand,\r | |
1297 | OUT CHAR8 *Result\r | |
1298 | );\r | |
1299 | \r | |
1300 | /**\r | |
1301 | UINTN -> UINT8 conversion\r | |
1302 | \r | |
1303 | Converts the value specified by Operand to a value specified by Result type\r | |
1304 | and stores the converted value into the caller allocated output buffer\r | |
1305 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1306 | least as large as the Result type.\r | |
1307 | \r | |
1308 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1309 | \r | |
1310 | If the conversion results in an overflow or an underflow condition, then\r | |
1311 | Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1312 | \r | |
1313 | @param[in] Operand Operand to be converted to new type\r | |
1314 | @param[out] Result Pointer to the result of conversion\r | |
1315 | \r | |
1316 | @retval RETURN_SUCCESS Successful conversion\r | |
1317 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1318 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1319 | **/\r | |
1320 | RETURN_STATUS\r | |
1321 | EFIAPI\r | |
1322 | SafeUintnToUint8 (\r | |
1323 | IN UINTN Operand,\r | |
93efab6d | 1324 | OUT UINT8 *Result\r |
d7a09cb8 SB |
1325 | );\r |
1326 | \r | |
1327 | /**\r | |
1328 | UINTN -> INT16 conversion\r | |
1329 | \r | |
1330 | Converts the value specified by Operand to a value specified by Result type\r | |
1331 | and stores the converted value into the caller allocated output buffer\r | |
1332 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1333 | least as large as the Result type.\r | |
1334 | \r | |
1335 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1336 | \r | |
1337 | If the conversion results in an overflow or an underflow condition, then\r | |
1338 | Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1339 | \r | |
1340 | @param[in] Operand Operand to be converted to new type\r | |
1341 | @param[out] Result Pointer to the result of conversion\r | |
1342 | \r | |
1343 | @retval RETURN_SUCCESS Successful conversion\r | |
1344 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1345 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1346 | **/\r | |
1347 | RETURN_STATUS\r | |
1348 | EFIAPI\r | |
1349 | SafeUintnToInt16 (\r | |
1350 | IN UINTN Operand,\r | |
1351 | OUT INT16 *Result\r | |
1352 | );\r | |
1353 | \r | |
1354 | /**\r | |
1355 | UINTN -> UINT16 conversion\r | |
1356 | \r | |
1357 | Converts the value specified by Operand to a value specified by Result type\r | |
1358 | and stores the converted value into the caller allocated output buffer\r | |
1359 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1360 | least as large as the Result type.\r | |
1361 | \r | |
1362 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1363 | \r | |
1364 | If the conversion results in an overflow or an underflow condition, then\r | |
1365 | Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1366 | \r | |
1367 | @param[in] Operand Operand to be converted to new type\r | |
1368 | @param[out] Result Pointer to the result of conversion\r | |
1369 | \r | |
1370 | @retval RETURN_SUCCESS Successful conversion\r | |
1371 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1372 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1373 | **/\r | |
1374 | RETURN_STATUS\r | |
1375 | EFIAPI\r | |
1376 | SafeUintnToUint16 (\r | |
1377 | IN UINTN Operand,\r | |
1378 | OUT UINT16 *Result\r | |
1379 | );\r | |
1380 | \r | |
1381 | /**\r | |
1382 | UINTN -> INT32 conversion\r | |
1383 | \r | |
1384 | Converts the value specified by Operand to a value specified by Result type\r | |
1385 | and stores the converted value into the caller allocated output buffer\r | |
1386 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1387 | least as large as the Result type.\r | |
1388 | \r | |
1389 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1390 | \r | |
1391 | If the conversion results in an overflow or an underflow condition, then\r | |
1392 | Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1393 | \r | |
1394 | @param[in] Operand Operand to be converted to new type\r | |
1395 | @param[out] Result Pointer to the result of conversion\r | |
1396 | \r | |
1397 | @retval RETURN_SUCCESS Successful conversion\r | |
1398 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1399 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1400 | **/\r | |
1401 | RETURN_STATUS\r | |
1402 | EFIAPI\r | |
1403 | SafeUintnToInt32 (\r | |
1404 | IN UINTN Operand,\r | |
1405 | OUT INT32 *Result\r | |
1406 | );\r | |
1407 | \r | |
1408 | /**\r | |
1409 | UINTN -> UINT32 conversion\r | |
1410 | \r | |
1411 | Converts the value specified by Operand to a value specified by Result type\r | |
1412 | and stores the converted value into the caller allocated output buffer\r | |
1413 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1414 | least as large as the Result type.\r | |
1415 | \r | |
1416 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1417 | \r | |
1418 | If the conversion results in an overflow or an underflow condition, then\r | |
1419 | Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1420 | \r | |
1421 | @param[in] Operand Operand to be converted to new type\r | |
1422 | @param[out] Result Pointer to the result of conversion\r | |
1423 | \r | |
1424 | @retval RETURN_SUCCESS Successful conversion\r | |
1425 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1426 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1427 | **/\r | |
1428 | RETURN_STATUS\r | |
1429 | EFIAPI\r | |
1430 | SafeUintnToUint32 (\r | |
1431 | IN UINTN Operand,\r | |
1432 | OUT UINT32 *Result\r | |
1433 | );\r | |
1434 | \r | |
1435 | /**\r | |
1436 | UINTN -> INTN conversion\r | |
1437 | \r | |
1438 | Converts the value specified by Operand to a value specified by Result type\r | |
1439 | and stores the converted value into the caller allocated output buffer\r | |
1440 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1441 | least as large as the Result type.\r | |
1442 | \r | |
1443 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1444 | \r | |
1445 | If the conversion results in an overflow or an underflow condition, then\r | |
1446 | Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1447 | \r | |
1448 | @param[in] Operand Operand to be converted to new type\r | |
1449 | @param[out] Result Pointer to the result of conversion\r | |
1450 | \r | |
1451 | @retval RETURN_SUCCESS Successful conversion\r | |
1452 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1453 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1454 | **/\r | |
1455 | RETURN_STATUS\r | |
1456 | EFIAPI\r | |
1457 | SafeUintnToIntn (\r | |
1458 | IN UINTN Operand,\r | |
1459 | OUT INTN *Result\r | |
1460 | );\r | |
1461 | \r | |
1462 | /**\r | |
1463 | UINTN -> INT64 conversion\r | |
1464 | \r | |
1465 | Converts the value specified by Operand to a value specified by Result type\r | |
1466 | and stores the converted value into the caller allocated output buffer\r | |
1467 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1468 | least as large as the Result type.\r | |
1469 | \r | |
1470 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1471 | \r | |
1472 | If the conversion results in an overflow or an underflow condition, then\r | |
1473 | Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1474 | \r | |
1475 | @param[in] Operand Operand to be converted to new type\r | |
1476 | @param[out] Result Pointer to the result of conversion\r | |
1477 | \r | |
1478 | @retval RETURN_SUCCESS Successful conversion\r | |
1479 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1480 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1481 | **/\r | |
1482 | RETURN_STATUS\r | |
1483 | EFIAPI\r | |
1484 | SafeUintnToInt64 (\r | |
1485 | IN UINTN Operand,\r | |
1486 | OUT INT64 *Result\r | |
1487 | );\r | |
1488 | \r | |
1489 | /**\r | |
1490 | INT64 -> INT8 conversion\r | |
1491 | \r | |
1492 | Converts the value specified by Operand to a value specified by Result type\r | |
1493 | and stores the converted value into the caller allocated output buffer\r | |
1494 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1495 | least as large as the Result type.\r | |
1496 | \r | |
1497 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1498 | \r | |
1499 | If the conversion results in an overflow or an underflow condition, then\r | |
1500 | Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1501 | \r | |
1502 | @param[in] Operand Operand to be converted to new type\r | |
1503 | @param[out] Result Pointer to the result of conversion\r | |
1504 | \r | |
1505 | @retval RETURN_SUCCESS Successful conversion\r | |
1506 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1507 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1508 | **/\r | |
1509 | RETURN_STATUS\r | |
1510 | EFIAPI\r | |
1511 | SafeInt64ToInt8 (\r | |
1512 | IN INT64 Operand,\r | |
1513 | OUT INT8 *Result\r | |
1514 | );\r | |
1515 | \r | |
1516 | /**\r | |
1517 | INT64 -> CHAR8 conversion\r | |
1518 | \r | |
1519 | Converts the value specified by Operand to a value specified by Result type\r | |
1520 | and stores the converted value into the caller allocated output buffer\r | |
1521 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1522 | least as large as the Result type.\r | |
1523 | \r | |
1524 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1525 | \r | |
1526 | If the conversion results in an overflow or an underflow condition, then\r | |
1527 | Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1528 | \r | |
1529 | @param[in] Operand Operand to be converted to new type\r | |
1530 | @param[out] Result Pointer to the result of conversion\r | |
1531 | \r | |
1532 | @retval RETURN_SUCCESS Successful conversion\r | |
1533 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1534 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1535 | **/\r | |
1536 | RETURN_STATUS\r | |
1537 | EFIAPI\r | |
1538 | SafeInt64ToChar8 (\r | |
1539 | IN INT64 Operand,\r | |
1540 | OUT CHAR8 *Result\r | |
1541 | );\r | |
1542 | \r | |
1543 | /**\r | |
1544 | INT64 -> UINT8 conversion\r | |
1545 | \r | |
1546 | Converts the value specified by Operand to a value specified by Result type\r | |
1547 | and stores the converted value into the caller allocated output buffer\r | |
1548 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1549 | least as large as the Result type.\r | |
1550 | \r | |
1551 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1552 | \r | |
1553 | If the conversion results in an overflow or an underflow condition, then\r | |
1554 | Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1555 | \r | |
1556 | @param[in] Operand Operand to be converted to new type\r | |
1557 | @param[out] Result Pointer to the result of conversion\r | |
1558 | \r | |
1559 | @retval RETURN_SUCCESS Successful conversion\r | |
1560 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1561 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1562 | **/\r | |
1563 | RETURN_STATUS\r | |
1564 | EFIAPI\r | |
1565 | SafeInt64ToUint8 (\r | |
1566 | IN INT64 Operand,\r | |
1567 | OUT UINT8 *Result\r | |
1568 | );\r | |
1569 | \r | |
1570 | /**\r | |
1571 | INT64 -> INT16 conversion\r | |
1572 | \r | |
1573 | Converts the value specified by Operand to a value specified by Result type\r | |
1574 | and stores the converted value into the caller allocated output buffer\r | |
1575 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1576 | least as large as the Result type.\r | |
1577 | \r | |
1578 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1579 | \r | |
1580 | If the conversion results in an overflow or an underflow condition, then\r | |
1581 | Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1582 | \r | |
1583 | @param[in] Operand Operand to be converted to new type\r | |
1584 | @param[out] Result Pointer to the result of conversion\r | |
1585 | \r | |
1586 | @retval RETURN_SUCCESS Successful conversion\r | |
1587 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1588 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1589 | **/\r | |
1590 | RETURN_STATUS\r | |
1591 | EFIAPI\r | |
1592 | SafeInt64ToInt16 (\r | |
1593 | IN INT64 Operand,\r | |
1594 | OUT INT16 *Result\r | |
1595 | );\r | |
1596 | \r | |
1597 | /**\r | |
1598 | INT64 -> UINT16 conversion\r | |
1599 | \r | |
1600 | Converts the value specified by Operand to a value specified by Result type\r | |
1601 | and stores the converted value into the caller allocated output buffer\r | |
1602 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1603 | least as large as the Result type.\r | |
1604 | \r | |
1605 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1606 | \r | |
1607 | If the conversion results in an overflow or an underflow condition, then\r | |
1608 | Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1609 | \r | |
1610 | @param[in] Operand Operand to be converted to new type\r | |
1611 | @param[out] Result Pointer to the result of conversion\r | |
1612 | \r | |
1613 | @retval RETURN_SUCCESS Successful conversion\r | |
1614 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1615 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1616 | **/\r | |
1617 | RETURN_STATUS\r | |
1618 | EFIAPI\r | |
1619 | SafeInt64ToUint16 (\r | |
1620 | IN INT64 Operand,\r | |
1621 | OUT UINT16 *Result\r | |
1622 | );\r | |
1623 | \r | |
1624 | /**\r | |
1625 | INT64 -> INT32 conversion\r | |
1626 | \r | |
1627 | Converts the value specified by Operand to a value specified by Result type\r | |
1628 | and stores the converted value into the caller allocated output buffer\r | |
1629 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1630 | least as large as the Result type.\r | |
1631 | \r | |
1632 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1633 | \r | |
1634 | If the conversion results in an overflow or an underflow condition, then\r | |
1635 | Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1636 | \r | |
1637 | @param[in] Operand Operand to be converted to new type\r | |
1638 | @param[out] Result Pointer to the result of conversion\r | |
1639 | \r | |
1640 | @retval RETURN_SUCCESS Successful conversion\r | |
1641 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1642 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1643 | **/\r | |
1644 | RETURN_STATUS\r | |
1645 | EFIAPI\r | |
1646 | SafeInt64ToInt32 (\r | |
1647 | IN INT64 Operand,\r | |
1648 | OUT INT32 *Result\r | |
1649 | );\r | |
1650 | \r | |
1651 | /**\r | |
1652 | INT64 -> UINT32 conversion\r | |
1653 | \r | |
1654 | Converts the value specified by Operand to a value specified by Result type\r | |
1655 | and stores the converted value into the caller allocated output buffer\r | |
1656 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1657 | least as large as the Result type.\r | |
1658 | \r | |
1659 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1660 | \r | |
1661 | If the conversion results in an overflow or an underflow condition, then\r | |
1662 | Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1663 | \r | |
1664 | @param[in] Operand Operand to be converted to new type\r | |
1665 | @param[out] Result Pointer to the result of conversion\r | |
1666 | \r | |
1667 | @retval RETURN_SUCCESS Successful conversion\r | |
1668 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1669 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1670 | **/\r | |
1671 | RETURN_STATUS\r | |
1672 | EFIAPI\r | |
1673 | SafeInt64ToUint32 (\r | |
1674 | IN INT64 Operand,\r | |
1675 | OUT UINT32 *Result\r | |
1676 | );\r | |
1677 | \r | |
1678 | /**\r | |
1679 | INT64 -> INTN conversion\r | |
1680 | \r | |
1681 | Converts the value specified by Operand to a value specified by Result type\r | |
1682 | and stores the converted value into the caller allocated output buffer\r | |
1683 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1684 | least as large as the Result type.\r | |
1685 | \r | |
1686 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1687 | \r | |
1688 | If the conversion results in an overflow or an underflow condition, then\r | |
1689 | Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1690 | \r | |
1691 | @param[in] Operand Operand to be converted to new type\r | |
1692 | @param[out] Result Pointer to the result of conversion\r | |
1693 | \r | |
1694 | @retval RETURN_SUCCESS Successful conversion\r | |
1695 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1696 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1697 | **/\r | |
1698 | RETURN_STATUS\r | |
1699 | EFIAPI\r | |
1700 | SafeInt64ToIntn (\r | |
1701 | IN INT64 Operand,\r | |
1702 | OUT INTN *Result\r | |
1703 | );\r | |
1704 | \r | |
1705 | /**\r | |
1706 | INT64 -> UINTN conversion\r | |
1707 | \r | |
1708 | Converts the value specified by Operand to a value specified by Result type\r | |
1709 | and stores the converted value into the caller allocated output buffer\r | |
1710 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1711 | least as large as the Result type.\r | |
1712 | \r | |
1713 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1714 | \r | |
1715 | If the conversion results in an overflow or an underflow condition, then\r | |
1716 | Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1717 | \r | |
1718 | @param[in] Operand Operand to be converted to new type\r | |
1719 | @param[out] Result Pointer to the result of conversion\r | |
1720 | \r | |
1721 | @retval RETURN_SUCCESS Successful conversion\r | |
1722 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1723 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1724 | **/\r | |
1725 | RETURN_STATUS\r | |
1726 | EFIAPI\r | |
1727 | SafeInt64ToUintn (\r | |
1728 | IN INT64 Operand,\r | |
1729 | OUT UINTN *Result\r | |
1730 | );\r | |
1731 | \r | |
1732 | /**\r | |
1733 | INT64 -> UINT64 conversion\r | |
1734 | \r | |
1735 | Converts the value specified by Operand to a value specified by Result type\r | |
1736 | and stores the converted value into the caller allocated output buffer\r | |
1737 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1738 | least as large as the Result type.\r | |
1739 | \r | |
1740 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1741 | \r | |
1742 | If the conversion results in an overflow or an underflow condition, then\r | |
1743 | Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1744 | \r | |
1745 | @param[in] Operand Operand to be converted to new type\r | |
1746 | @param[out] Result Pointer to the result of conversion\r | |
1747 | \r | |
1748 | @retval RETURN_SUCCESS Successful conversion\r | |
1749 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1750 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1751 | **/\r | |
1752 | RETURN_STATUS\r | |
1753 | EFIAPI\r | |
1754 | SafeInt64ToUint64 (\r | |
1755 | IN INT64 Operand,\r | |
1756 | OUT UINT64 *Result\r | |
1757 | );\r | |
1758 | \r | |
1759 | /**\r | |
1760 | UINT64 -> INT8 conversion\r | |
1761 | \r | |
1762 | Converts the value specified by Operand to a value specified by Result type\r | |
1763 | and stores the converted value into the caller allocated output buffer\r | |
1764 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1765 | least as large as the Result type.\r | |
1766 | \r | |
1767 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1768 | \r | |
1769 | If the conversion results in an overflow or an underflow condition, then\r | |
1770 | Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1771 | \r | |
1772 | @param[in] Operand Operand to be converted to new type\r | |
1773 | @param[out] Result Pointer to the result of conversion\r | |
1774 | \r | |
1775 | @retval RETURN_SUCCESS Successful conversion\r | |
1776 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1777 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1778 | **/\r | |
1779 | RETURN_STATUS\r | |
1780 | EFIAPI\r | |
1781 | SafeUint64ToInt8 (\r | |
1782 | IN UINT64 Operand,\r | |
1783 | OUT INT8 *Result\r | |
1784 | );\r | |
1785 | \r | |
1786 | /**\r | |
1787 | UINT64 -> CHAR8 conversion\r | |
1788 | \r | |
1789 | Converts the value specified by Operand to a value specified by Result type\r | |
1790 | and stores the converted value into the caller allocated output buffer\r | |
1791 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1792 | least as large as the Result type.\r | |
1793 | \r | |
1794 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1795 | \r | |
1796 | If the conversion results in an overflow or an underflow condition, then\r | |
1797 | Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1798 | \r | |
1799 | @param[in] Operand Operand to be converted to new type\r | |
1800 | @param[out] Result Pointer to the result of conversion\r | |
1801 | \r | |
1802 | @retval RETURN_SUCCESS Successful conversion\r | |
1803 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1804 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1805 | **/\r | |
1806 | RETURN_STATUS\r | |
1807 | EFIAPI\r | |
1808 | SafeUint64ToChar8 (\r | |
1809 | IN UINT64 Operand,\r | |
1810 | OUT CHAR8 *Result\r | |
1811 | );\r | |
1812 | \r | |
1813 | /**\r | |
1814 | UINT64 -> UINT8 conversion\r | |
1815 | \r | |
1816 | Converts the value specified by Operand to a value specified by Result type\r | |
1817 | and stores the converted value into the caller allocated output buffer\r | |
1818 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1819 | least as large as the Result type.\r | |
1820 | \r | |
1821 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1822 | \r | |
1823 | If the conversion results in an overflow or an underflow condition, then\r | |
1824 | Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1825 | \r | |
1826 | @param[in] Operand Operand to be converted to new type\r | |
1827 | @param[out] Result Pointer to the result of conversion\r | |
1828 | \r | |
1829 | @retval RETURN_SUCCESS Successful conversion\r | |
1830 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1831 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1832 | **/\r | |
1833 | RETURN_STATUS\r | |
1834 | EFIAPI\r | |
1835 | SafeUint64ToUint8 (\r | |
1836 | IN UINT64 Operand,\r | |
1837 | OUT UINT8 *Result\r | |
1838 | );\r | |
1839 | \r | |
1840 | /**\r | |
1841 | UINT64 -> INT16 conversion\r | |
1842 | \r | |
1843 | Converts the value specified by Operand to a value specified by Result type\r | |
1844 | and stores the converted value into the caller allocated output buffer\r | |
1845 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1846 | least as large as the Result type.\r | |
1847 | \r | |
1848 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1849 | \r | |
1850 | If the conversion results in an overflow or an underflow condition, then\r | |
1851 | Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1852 | \r | |
1853 | @param[in] Operand Operand to be converted to new type\r | |
1854 | @param[out] Result Pointer to the result of conversion\r | |
1855 | \r | |
1856 | @retval RETURN_SUCCESS Successful conversion\r | |
1857 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1858 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1859 | **/\r | |
1860 | RETURN_STATUS\r | |
1861 | EFIAPI\r | |
1862 | SafeUint64ToInt16 (\r | |
1863 | IN UINT64 Operand,\r | |
1864 | OUT INT16 *Result\r | |
1865 | );\r | |
1866 | \r | |
1867 | /**\r | |
1868 | UINT64 -> UINT16 conversion\r | |
1869 | \r | |
1870 | Converts the value specified by Operand to a value specified by Result type\r | |
1871 | and stores the converted value into the caller allocated output buffer\r | |
1872 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1873 | least as large as the Result type.\r | |
1874 | \r | |
1875 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1876 | \r | |
1877 | If the conversion results in an overflow or an underflow condition, then\r | |
1878 | Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1879 | \r | |
1880 | @param[in] Operand Operand to be converted to new type\r | |
1881 | @param[out] Result Pointer to the result of conversion\r | |
1882 | \r | |
1883 | @retval RETURN_SUCCESS Successful conversion\r | |
1884 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1885 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1886 | **/\r | |
1887 | RETURN_STATUS\r | |
1888 | EFIAPI\r | |
1889 | SafeUint64ToUint16 (\r | |
1890 | IN UINT64 Operand,\r | |
1891 | OUT UINT16 *Result\r | |
1892 | );\r | |
1893 | \r | |
1894 | /**\r | |
1895 | UINT64 -> INT32 conversion\r | |
1896 | \r | |
1897 | Converts the value specified by Operand to a value specified by Result type\r | |
1898 | and stores the converted value into the caller allocated output buffer\r | |
1899 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1900 | least as large as the Result type.\r | |
1901 | \r | |
1902 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1903 | \r | |
1904 | If the conversion results in an overflow or an underflow condition, then\r | |
1905 | Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1906 | \r | |
1907 | @param[in] Operand Operand to be converted to new type\r | |
1908 | @param[out] Result Pointer to the result of conversion\r | |
1909 | \r | |
1910 | @retval RETURN_SUCCESS Successful conversion\r | |
1911 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1912 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1913 | **/\r | |
1914 | RETURN_STATUS\r | |
1915 | EFIAPI\r | |
1916 | SafeUint64ToInt32 (\r | |
1917 | IN UINT64 Operand,\r | |
1918 | OUT INT32 *Result\r | |
1919 | );\r | |
1920 | \r | |
1921 | /**\r | |
1922 | UINT64 -> UINT32 conversion\r | |
1923 | \r | |
1924 | Converts the value specified by Operand to a value specified by Result type\r | |
1925 | and stores the converted value into the caller allocated output buffer\r | |
1926 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1927 | least as large as the Result type.\r | |
1928 | \r | |
1929 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1930 | \r | |
1931 | If the conversion results in an overflow or an underflow condition, then\r | |
1932 | Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1933 | \r | |
1934 | @param[in] Operand Operand to be converted to new type\r | |
1935 | @param[out] Result Pointer to the result of conversion\r | |
1936 | \r | |
1937 | @retval RETURN_SUCCESS Successful conversion\r | |
1938 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1939 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1940 | **/\r | |
1941 | RETURN_STATUS\r | |
1942 | EFIAPI\r | |
1943 | SafeUint64ToUint32 (\r | |
1944 | IN UINT64 Operand,\r | |
1945 | OUT UINT32 *Result\r | |
1946 | );\r | |
1947 | \r | |
1948 | /**\r | |
1949 | UINT64 -> INTN conversion\r | |
1950 | \r | |
1951 | Converts the value specified by Operand to a value specified by Result type\r | |
1952 | and stores the converted value into the caller allocated output buffer\r | |
1953 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1954 | least as large as the Result type.\r | |
1955 | \r | |
1956 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1957 | \r | |
1958 | If the conversion results in an overflow or an underflow condition, then\r | |
1959 | Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1960 | \r | |
1961 | @param[in] Operand Operand to be converted to new type\r | |
1962 | @param[out] Result Pointer to the result of conversion\r | |
1963 | \r | |
1964 | @retval RETURN_SUCCESS Successful conversion\r | |
1965 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1966 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1967 | **/\r | |
1968 | RETURN_STATUS\r | |
1969 | EFIAPI\r | |
1970 | SafeUint64ToIntn (\r | |
1971 | IN UINT64 Operand,\r | |
1972 | OUT INTN *Result\r | |
1973 | );\r | |
1974 | \r | |
1975 | /**\r | |
1976 | UINT64 -> UINTN conversion\r | |
1977 | \r | |
1978 | Converts the value specified by Operand to a value specified by Result type\r | |
1979 | and stores the converted value into the caller allocated output buffer\r | |
1980 | specified by Result. The caller must pass in a Result buffer that is at\r | |
1981 | least as large as the Result type.\r | |
1982 | \r | |
1983 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
1984 | \r | |
1985 | If the conversion results in an overflow or an underflow condition, then\r | |
1986 | Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
1987 | \r | |
1988 | @param[in] Operand Operand to be converted to new type\r | |
1989 | @param[out] Result Pointer to the result of conversion\r | |
1990 | \r | |
1991 | @retval RETURN_SUCCESS Successful conversion\r | |
1992 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
1993 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
1994 | **/\r | |
1995 | RETURN_STATUS\r | |
1996 | EFIAPI\r | |
1997 | SafeUint64ToUintn (\r | |
1998 | IN UINT64 Operand,\r | |
1999 | OUT UINTN *Result\r | |
2000 | );\r | |
2001 | \r | |
2002 | /**\r | |
2003 | UINT64 -> INT64 conversion\r | |
2004 | \r | |
2005 | Converts the value specified by Operand to a value specified by Result type\r | |
2006 | and stores the converted value into the caller allocated output buffer\r | |
2007 | specified by Result. The caller must pass in a Result buffer that is at\r | |
2008 | least as large as the Result type.\r | |
2009 | \r | |
2010 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2011 | \r | |
2012 | If the conversion results in an overflow or an underflow condition, then\r | |
2013 | Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2014 | \r | |
2015 | @param[in] Operand Operand to be converted to new type\r | |
2016 | @param[out] Result Pointer to the result of conversion\r | |
2017 | \r | |
2018 | @retval RETURN_SUCCESS Successful conversion\r | |
2019 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2020 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2021 | **/\r | |
2022 | RETURN_STATUS\r | |
2023 | EFIAPI\r | |
2024 | SafeUint64ToInt64 (\r | |
2025 | IN UINT64 Operand,\r | |
2026 | OUT INT64 *Result\r | |
2027 | );\r | |
2028 | \r | |
2029 | //\r | |
2030 | // Addition functions\r | |
2031 | //\r | |
2032 | \r | |
2033 | /**\r | |
2034 | UINT8 addition\r | |
2035 | \r | |
2036 | Performs the requested operation using the input parameters into a value\r | |
2037 | specified by Result type and stores the converted value into the caller\r | |
2038 | allocated output buffer specified by Result. The caller must pass in a\r | |
2039 | Result buffer that is at least as large as the Result type.\r | |
2040 | \r | |
2041 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2042 | \r | |
2043 | If the requested operation results in an overflow or an underflow condition,\r | |
2044 | then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2045 | \r | |
2046 | @param[in] Augend A number to which addend will be added\r | |
2047 | @param[in] Addend A number to be added to another\r | |
2048 | @param[out] Result Pointer to the result of addition\r | |
2049 | \r | |
2050 | @retval RETURN_SUCCESS Successful addition\r | |
2051 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2052 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2053 | **/\r | |
2054 | RETURN_STATUS\r | |
2055 | EFIAPI\r | |
2056 | SafeUint8Add (\r | |
2057 | IN UINT8 Augend,\r | |
2058 | IN UINT8 Addend,\r | |
2059 | OUT UINT8 *Result\r | |
2060 | );\r | |
2061 | \r | |
2062 | /**\r | |
2063 | UINT16 addition\r | |
2064 | \r | |
2065 | Performs the requested operation using the input parameters into a value\r | |
2066 | specified by Result type and stores the converted value into the caller\r | |
2067 | allocated output buffer specified by Result. The caller must pass in a\r | |
2068 | Result buffer that is at least as large as the Result type.\r | |
2069 | \r | |
2070 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2071 | \r | |
2072 | If the requested operation results in an overflow or an underflow condition,\r | |
2073 | then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2074 | \r | |
2075 | @param[in] Augend A number to which addend will be added\r | |
2076 | @param[in] Addend A number to be added to another\r | |
2077 | @param[out] Result Pointer to the result of addition\r | |
2078 | \r | |
2079 | @retval RETURN_SUCCESS Successful addition\r | |
2080 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2081 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2082 | **/\r | |
2083 | RETURN_STATUS\r | |
2084 | EFIAPI\r | |
2085 | SafeUint16Add (\r | |
2086 | IN UINT16 Augend,\r | |
2087 | IN UINT16 Addend,\r | |
2088 | OUT UINT16 *Result\r | |
2089 | );\r | |
2090 | \r | |
2091 | /**\r | |
2092 | UINT32 addition\r | |
2093 | \r | |
2094 | Performs the requested operation using the input parameters into a value\r | |
2095 | specified by Result type and stores the converted value into the caller\r | |
2096 | allocated output buffer specified by Result. The caller must pass in a\r | |
2097 | Result buffer that is at least as large as the Result type.\r | |
2098 | \r | |
2099 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2100 | \r | |
2101 | If the requested operation results in an overflow or an underflow condition,\r | |
2102 | then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2103 | \r | |
2104 | @param[in] Augend A number to which addend will be added\r | |
2105 | @param[in] Addend A number to be added to another\r | |
2106 | @param[out] Result Pointer to the result of addition\r | |
2107 | \r | |
2108 | @retval RETURN_SUCCESS Successful addition\r | |
2109 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2110 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2111 | **/\r | |
2112 | RETURN_STATUS\r | |
2113 | EFIAPI\r | |
2114 | SafeUint32Add (\r | |
2115 | IN UINT32 Augend,\r | |
2116 | IN UINT32 Addend,\r | |
2117 | OUT UINT32 *Result\r | |
2118 | );\r | |
2119 | \r | |
2120 | /**\r | |
2121 | UINTN addition\r | |
2122 | \r | |
2123 | Performs the requested operation using the input parameters into a value\r | |
2124 | specified by Result type and stores the converted value into the caller\r | |
2125 | allocated output buffer specified by Result. The caller must pass in a\r | |
2126 | Result buffer that is at least as large as the Result type.\r | |
2127 | \r | |
2128 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2129 | \r | |
2130 | If the requested operation results in an overflow or an underflow condition,\r | |
2131 | then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2132 | \r | |
2133 | @param[in] Augend A number to which addend will be added\r | |
2134 | @param[in] Addend A number to be added to another\r | |
2135 | @param[out] Result Pointer to the result of addition\r | |
2136 | \r | |
2137 | @retval RETURN_SUCCESS Successful addition\r | |
2138 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2139 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2140 | **/\r | |
2141 | RETURN_STATUS\r | |
2142 | EFIAPI\r | |
2143 | SafeUintnAdd (\r | |
2144 | IN UINTN Augend,\r | |
2145 | IN UINTN Addend,\r | |
2146 | OUT UINTN *Result\r | |
2147 | );\r | |
2148 | \r | |
2149 | /**\r | |
2150 | UINT64 addition\r | |
2151 | \r | |
2152 | Performs the requested operation using the input parameters into a value\r | |
2153 | specified by Result type and stores the converted value into the caller\r | |
2154 | allocated output buffer specified by Result. The caller must pass in a\r | |
2155 | Result buffer that is at least as large as the Result type.\r | |
2156 | \r | |
2157 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2158 | \r | |
2159 | If the requested operation results in an overflow or an underflow condition,\r | |
2160 | then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2161 | \r | |
2162 | @param[in] Augend A number to which addend will be added\r | |
2163 | @param[in] Addend A number to be added to another\r | |
2164 | @param[out] Result Pointer to the result of addition\r | |
2165 | \r | |
2166 | @retval RETURN_SUCCESS Successful addition\r | |
2167 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2168 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2169 | **/\r | |
2170 | RETURN_STATUS\r | |
2171 | EFIAPI\r | |
2172 | SafeUint64Add (\r | |
2173 | IN UINT64 Augend,\r | |
2174 | IN UINT64 Addend,\r | |
2175 | OUT UINT64 *Result\r | |
2176 | );\r | |
2177 | \r | |
2178 | //\r | |
2179 | // Subtraction functions\r | |
2180 | //\r | |
2181 | \r | |
2182 | /**\r | |
2183 | UINT8 subtraction\r | |
2184 | \r | |
2185 | Performs the requested operation using the input parameters into a value\r | |
2186 | specified by Result type and stores the converted value into the caller\r | |
2187 | allocated output buffer specified by Result. The caller must pass in a\r | |
2188 | Result buffer that is at least as large as the Result type.\r | |
2189 | \r | |
2190 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2191 | \r | |
2192 | If the requested operation results in an overflow or an underflow condition,\r | |
2193 | then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2194 | \r | |
2195 | @param[in] Minuend A number from which another is to be subtracted.\r | |
2196 | @param[in] Subtrahend A number to be subtracted from another\r | |
2197 | @param[out] Result Pointer to the result of subtraction\r | |
2198 | \r | |
2199 | @retval RETURN_SUCCESS Successful subtraction\r | |
2200 | @retval RETURN_BUFFER_TOO_SMALL Underflow\r | |
2201 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2202 | **/\r | |
2203 | RETURN_STATUS\r | |
2204 | EFIAPI\r | |
2205 | SafeUint8Sub (\r | |
2206 | IN UINT8 Minuend,\r | |
2207 | IN UINT8 Subtrahend,\r | |
2208 | OUT UINT8 *Result\r | |
2209 | );\r | |
2210 | \r | |
2211 | /**\r | |
2212 | UINT16 subtraction\r | |
2213 | \r | |
2214 | Performs the requested operation using the input parameters into a value\r | |
2215 | specified by Result type and stores the converted value into the caller\r | |
2216 | allocated output buffer specified by Result. The caller must pass in a\r | |
2217 | Result buffer that is at least as large as the Result type.\r | |
2218 | \r | |
2219 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2220 | \r | |
2221 | If the requested operation results in an overflow or an underflow condition,\r | |
2222 | then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2223 | \r | |
2224 | @param[in] Minuend A number from which another is to be subtracted.\r | |
2225 | @param[in] Subtrahend A number to be subtracted from another\r | |
2226 | @param[out] Result Pointer to the result of subtraction\r | |
2227 | \r | |
2228 | @retval RETURN_SUCCESS Successful subtraction\r | |
2229 | @retval RETURN_BUFFER_TOO_SMALL Underflow\r | |
2230 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2231 | **/\r | |
2232 | RETURN_STATUS\r | |
2233 | EFIAPI\r | |
2234 | SafeUint16Sub (\r | |
2235 | IN UINT16 Minuend,\r | |
2236 | IN UINT16 Subtrahend,\r | |
2237 | OUT UINT16 *Result\r | |
2238 | );\r | |
2239 | \r | |
2240 | /**\r | |
2241 | UINT32 subtraction\r | |
2242 | \r | |
2243 | Performs the requested operation using the input parameters into a value\r | |
2244 | specified by Result type and stores the converted value into the caller\r | |
2245 | allocated output buffer specified by Result. The caller must pass in a\r | |
2246 | Result buffer that is at least as large as the Result type.\r | |
2247 | \r | |
2248 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2249 | \r | |
2250 | If the requested operation results in an overflow or an underflow condition,\r | |
2251 | then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2252 | \r | |
2253 | @param[in] Minuend A number from which another is to be subtracted.\r | |
2254 | @param[in] Subtrahend A number to be subtracted from another\r | |
2255 | @param[out] Result Pointer to the result of subtraction\r | |
2256 | \r | |
2257 | @retval RETURN_SUCCESS Successful subtraction\r | |
2258 | @retval RETURN_BUFFER_TOO_SMALL Underflow\r | |
2259 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2260 | **/\r | |
2261 | RETURN_STATUS\r | |
2262 | EFIAPI\r | |
2263 | SafeUint32Sub (\r | |
2264 | IN UINT32 Minuend,\r | |
2265 | IN UINT32 Subtrahend,\r | |
2266 | OUT UINT32 *Result\r | |
2267 | );\r | |
2268 | \r | |
2269 | /**\r | |
2270 | UINTN subtraction\r | |
2271 | \r | |
2272 | Performs the requested operation using the input parameters into a value\r | |
2273 | specified by Result type and stores the converted value into the caller\r | |
2274 | allocated output buffer specified by Result. The caller must pass in a\r | |
2275 | Result buffer that is at least as large as the Result type.\r | |
2276 | \r | |
2277 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2278 | \r | |
2279 | If the requested operation results in an overflow or an underflow condition,\r | |
2280 | then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2281 | \r | |
2282 | @param[in] Minuend A number from which another is to be subtracted.\r | |
2283 | @param[in] Subtrahend A number to be subtracted from another\r | |
2284 | @param[out] Result Pointer to the result of subtraction\r | |
2285 | \r | |
2286 | @retval RETURN_SUCCESS Successful subtraction\r | |
2287 | @retval RETURN_BUFFER_TOO_SMALL Underflow\r | |
2288 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2289 | **/\r | |
2290 | RETURN_STATUS\r | |
2291 | EFIAPI\r | |
2292 | SafeUintnSub (\r | |
2293 | IN UINTN Minuend,\r | |
2294 | IN UINTN Subtrahend,\r | |
2295 | OUT UINTN *Result\r | |
2296 | );\r | |
2297 | \r | |
2298 | /**\r | |
2299 | UINT64 subtraction\r | |
2300 | \r | |
2301 | Performs the requested operation using the input parameters into a value\r | |
2302 | specified by Result type and stores the converted value into the caller\r | |
2303 | allocated output buffer specified by Result. The caller must pass in a\r | |
2304 | Result buffer that is at least as large as the Result type.\r | |
2305 | \r | |
2306 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2307 | \r | |
2308 | If the requested operation results in an overflow or an underflow condition,\r | |
2309 | then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2310 | \r | |
2311 | @param[in] Minuend A number from which another is to be subtracted.\r | |
2312 | @param[in] Subtrahend A number to be subtracted from another\r | |
2313 | @param[out] Result Pointer to the result of subtraction\r | |
2314 | \r | |
2315 | @retval RETURN_SUCCESS Successful subtraction\r | |
2316 | @retval RETURN_BUFFER_TOO_SMALL Underflow\r | |
2317 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2318 | **/\r | |
2319 | RETURN_STATUS\r | |
2320 | EFIAPI\r | |
2321 | SafeUint64Sub (\r | |
2322 | IN UINT64 Minuend,\r | |
2323 | IN UINT64 Subtrahend,\r | |
2324 | OUT UINT64 *Result\r | |
2325 | );\r | |
2326 | \r | |
2327 | //\r | |
2328 | // Multiplication functions\r | |
2329 | //\r | |
2330 | \r | |
2331 | /**\r | |
2332 | UINT8 multiplication\r | |
2333 | \r | |
2334 | Performs the requested operation using the input parameters into a value\r | |
2335 | specified by Result type and stores the converted value into the caller\r | |
2336 | allocated output buffer specified by Result. The caller must pass in a\r | |
2337 | Result buffer that is at least as large as the Result type.\r | |
2338 | \r | |
2339 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2340 | \r | |
2341 | If the requested operation results in an overflow or an underflow condition,\r | |
2342 | then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2343 | \r | |
2344 | @param[in] Multiplicand A number that is to be multiplied by another\r | |
2345 | @param[in] Multiplier A number by which the multiplicand is to be multiplied\r | |
2346 | @param[out] Result Pointer to the result of multiplication\r | |
2347 | \r | |
2348 | @retval RETURN_SUCCESS Successful multiplication\r | |
2349 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2350 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2351 | **/\r | |
2352 | RETURN_STATUS\r | |
2353 | EFIAPI\r | |
2354 | SafeUint8Mult (\r | |
2355 | IN UINT8 Multiplicand,\r | |
2356 | IN UINT8 Multiplier,\r | |
2357 | OUT UINT8 *Result\r | |
2358 | );\r | |
2359 | \r | |
2360 | /**\r | |
2361 | UINT16 multiplication\r | |
2362 | \r | |
2363 | Performs the requested operation using the input parameters into a value\r | |
2364 | specified by Result type and stores the converted value into the caller\r | |
2365 | allocated output buffer specified by Result. The caller must pass in a\r | |
2366 | Result buffer that is at least as large as the Result type.\r | |
2367 | \r | |
2368 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2369 | \r | |
2370 | If the requested operation results in an overflow or an underflow condition,\r | |
2371 | then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2372 | \r | |
2373 | @param[in] Multiplicand A number that is to be multiplied by another\r | |
2374 | @param[in] Multiplier A number by which the multiplicand is to be multiplied\r | |
2375 | @param[out] Result Pointer to the result of multiplication\r | |
2376 | \r | |
2377 | @retval RETURN_SUCCESS Successful multiplication\r | |
2378 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2379 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2380 | **/\r | |
2381 | RETURN_STATUS\r | |
2382 | EFIAPI\r | |
2383 | SafeUint16Mult (\r | |
2384 | IN UINT16 Multiplicand,\r | |
2385 | IN UINT16 Multiplier,\r | |
2386 | OUT UINT16 *Result\r | |
2387 | );\r | |
2388 | \r | |
2389 | /**\r | |
2390 | UINT32 multiplication\r | |
2391 | \r | |
2392 | Performs the requested operation using the input parameters into a value\r | |
2393 | specified by Result type and stores the converted value into the caller\r | |
2394 | allocated output buffer specified by Result. The caller must pass in a\r | |
2395 | Result buffer that is at least as large as the Result type.\r | |
2396 | \r | |
2397 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2398 | \r | |
2399 | If the requested operation results in an overflow or an underflow condition,\r | |
2400 | then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2401 | \r | |
2402 | @param[in] Multiplicand A number that is to be multiplied by another\r | |
2403 | @param[in] Multiplier A number by which the multiplicand is to be multiplied\r | |
2404 | @param[out] Result Pointer to the result of multiplication\r | |
2405 | \r | |
2406 | @retval RETURN_SUCCESS Successful multiplication\r | |
2407 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2408 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2409 | **/\r | |
2410 | RETURN_STATUS\r | |
2411 | EFIAPI\r | |
2412 | SafeUint32Mult (\r | |
2413 | IN UINT32 Multiplicand,\r | |
2414 | IN UINT32 Multiplier,\r | |
2415 | OUT UINT32 *Result\r | |
2416 | );\r | |
2417 | \r | |
2418 | /**\r | |
2419 | UINTN multiplication\r | |
2420 | \r | |
2421 | Performs the requested operation using the input parameters into a value\r | |
2422 | specified by Result type and stores the converted value into the caller\r | |
2423 | allocated output buffer specified by Result. The caller must pass in a\r | |
2424 | Result buffer that is at least as large as the Result type.\r | |
2425 | \r | |
2426 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2427 | \r | |
2428 | If the requested operation results in an overflow or an underflow condition,\r | |
2429 | then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2430 | \r | |
2431 | @param[in] Multiplicand A number that is to be multiplied by another\r | |
2432 | @param[in] Multiplier A number by which the multiplicand is to be multiplied\r | |
2433 | @param[out] Result Pointer to the result of multiplication\r | |
2434 | \r | |
2435 | @retval RETURN_SUCCESS Successful multiplication\r | |
2436 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2437 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2438 | **/\r | |
2439 | RETURN_STATUS\r | |
2440 | EFIAPI\r | |
2441 | SafeUintnMult (\r | |
2442 | IN UINTN Multiplicand,\r | |
2443 | IN UINTN Multiplier,\r | |
2444 | OUT UINTN *Result\r | |
2445 | );\r | |
2446 | \r | |
2447 | /**\r | |
2448 | UINT64 multiplication\r | |
2449 | \r | |
2450 | Performs the requested operation using the input parameters into a value\r | |
2451 | specified by Result type and stores the converted value into the caller\r | |
2452 | allocated output buffer specified by Result. The caller must pass in a\r | |
2453 | Result buffer that is at least as large as the Result type.\r | |
2454 | \r | |
2455 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2456 | \r | |
2457 | If the requested operation results in an overflow or an underflow condition,\r | |
2458 | then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2459 | \r | |
2460 | @param[in] Multiplicand A number that is to be multiplied by another\r | |
2461 | @param[in] Multiplier A number by which the multiplicand is to be multiplied\r | |
2462 | @param[out] Result Pointer to the result of multiplication\r | |
2463 | \r | |
2464 | @retval RETURN_SUCCESS Successful multiplication\r | |
2465 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2466 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2467 | **/\r | |
2468 | RETURN_STATUS\r | |
2469 | EFIAPI\r | |
2470 | SafeUint64Mult (\r | |
2471 | IN UINT64 Multiplicand,\r | |
2472 | IN UINT64 Multiplier,\r | |
2473 | OUT UINT64 *Result\r | |
2474 | );\r | |
2475 | \r | |
2476 | //\r | |
2477 | // Signed operations\r | |
2478 | //\r | |
2479 | // Strongly consider using unsigned numbers.\r | |
2480 | //\r | |
2481 | // Signed numbers are often used where unsigned numbers should be used.\r | |
2482 | // For example file sizes and array indices should always be unsigned.\r | |
2483 | // Subtracting a larger positive signed number from a smaller positive\r | |
2484 | // signed number with SafeInt32Sub will succeed, producing a negative number,\r | |
2485 | // that then must not be used as an array index (but can occasionally be\r | |
2486 | // used as a pointer index.) Similarly for adding a larger magnitude\r | |
2487 | // negative number to a smaller magnitude positive number.\r | |
2488 | //\r | |
2489 | // This library does not protect you from such errors. It tells you if your\r | |
2490 | // integer operations overflowed, not if you are doing the right thing\r | |
2491 | // with your non-overflowed integers.\r | |
2492 | //\r | |
2493 | // Likewise you can overflow a buffer with a non-overflowed unsigned index.\r | |
2494 | //\r | |
2495 | \r | |
2496 | //\r | |
2497 | // Signed addition functions\r | |
2498 | //\r | |
2499 | \r | |
2500 | /**\r | |
2501 | INT8 Addition\r | |
2502 | \r | |
2503 | Performs the requested operation using the input parameters into a value\r | |
2504 | specified by Result type and stores the converted value into the caller\r | |
2505 | allocated output buffer specified by Result. The caller must pass in a\r | |
2506 | Result buffer that is at least as large as the Result type.\r | |
2507 | \r | |
2508 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2509 | \r | |
2510 | If the requested operation results in an overflow or an underflow condition,\r | |
2511 | then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2512 | \r | |
2513 | @param[in] Augend A number to which addend will be added\r | |
2514 | @param[in] Addend A number to be added to another\r | |
2515 | @param[out] Result Pointer to the result of addition\r | |
2516 | \r | |
2517 | @retval RETURN_SUCCESS Successful addition\r | |
2518 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2519 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2520 | **/\r | |
2521 | RETURN_STATUS\r | |
2522 | EFIAPI\r | |
2523 | SafeInt8Add (\r | |
2524 | IN INT8 Augend,\r | |
2525 | IN INT8 Addend,\r | |
2526 | OUT INT8 *Result\r | |
2527 | );\r | |
2528 | \r | |
2529 | /**\r | |
2530 | CHAR8 Addition\r | |
2531 | \r | |
2532 | Performs the requested operation using the input parameters into a value\r | |
2533 | specified by Result type and stores the converted value into the caller\r | |
2534 | allocated output buffer specified by Result. The caller must pass in a\r | |
2535 | Result buffer that is at least as large as the Result type.\r | |
2536 | \r | |
2537 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2538 | \r | |
2539 | If the requested operation results in an overflow or an underflow condition,\r | |
2540 | then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2541 | \r | |
2542 | @param[in] Augend A number to which addend will be added\r | |
2543 | @param[in] Addend A number to be added to another\r | |
2544 | @param[out] Result Pointer to the result of addition\r | |
2545 | \r | |
2546 | @retval RETURN_SUCCESS Successful addition\r | |
2547 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2548 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2549 | **/\r | |
2550 | RETURN_STATUS\r | |
2551 | EFIAPI\r | |
2552 | SafeChar8Add (\r | |
2553 | IN CHAR8 Augend,\r | |
2554 | IN CHAR8 Addend,\r | |
2555 | OUT CHAR8 *Result\r | |
2556 | );\r | |
2557 | \r | |
2558 | /**\r | |
2559 | INT16 Addition\r | |
2560 | \r | |
2561 | Performs the requested operation using the input parameters into a value\r | |
2562 | specified by Result type and stores the converted value into the caller\r | |
2563 | allocated output buffer specified by Result. The caller must pass in a\r | |
2564 | Result buffer that is at least as large as the Result type.\r | |
2565 | \r | |
2566 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2567 | \r | |
2568 | If the requested operation results in an overflow or an underflow condition,\r | |
2569 | then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2570 | \r | |
2571 | @param[in] Augend A number to which addend will be added\r | |
2572 | @param[in] Addend A number to be added to another\r | |
2573 | @param[out] Result Pointer to the result of addition\r | |
2574 | \r | |
2575 | @retval RETURN_SUCCESS Successful addition\r | |
2576 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2577 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2578 | **/\r | |
2579 | RETURN_STATUS\r | |
2580 | EFIAPI\r | |
2581 | SafeInt16Add (\r | |
2582 | IN INT16 Augend,\r | |
2583 | IN INT16 Addend,\r | |
2584 | OUT INT16 *Result\r | |
2585 | );\r | |
2586 | \r | |
2587 | /**\r | |
2588 | INT32 Addition\r | |
2589 | \r | |
2590 | Performs the requested operation using the input parameters into a value\r | |
2591 | specified by Result type and stores the converted value into the caller\r | |
2592 | allocated output buffer specified by Result. The caller must pass in a\r | |
2593 | Result buffer that is at least as large as the Result type.\r | |
2594 | \r | |
2595 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2596 | \r | |
2597 | If the requested operation results in an overflow or an underflow condition,\r | |
2598 | then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2599 | \r | |
2600 | @param[in] Augend A number to which addend will be added\r | |
2601 | @param[in] Addend A number to be added to another\r | |
2602 | @param[out] Result Pointer to the result of addition\r | |
2603 | \r | |
2604 | @retval RETURN_SUCCESS Successful addition\r | |
2605 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2606 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2607 | **/\r | |
2608 | RETURN_STATUS\r | |
2609 | EFIAPI\r | |
2610 | SafeInt32Add (\r | |
2611 | IN INT32 Augend,\r | |
2612 | IN INT32 Addend,\r | |
2613 | OUT INT32 *Result\r | |
2614 | );\r | |
2615 | \r | |
2616 | /**\r | |
2617 | INTN Addition\r | |
2618 | \r | |
2619 | Performs the requested operation using the input parameters into a value\r | |
2620 | specified by Result type and stores the converted value into the caller\r | |
2621 | allocated output buffer specified by Result. The caller must pass in a\r | |
2622 | Result buffer that is at least as large as the Result type.\r | |
2623 | \r | |
2624 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2625 | \r | |
2626 | If the requested operation results in an overflow or an underflow condition,\r | |
2627 | then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2628 | \r | |
2629 | @param[in] Augend A number to which addend will be added\r | |
2630 | @param[in] Addend A number to be added to another\r | |
2631 | @param[out] Result Pointer to the result of addition\r | |
2632 | \r | |
2633 | @retval RETURN_SUCCESS Successful addition\r | |
2634 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2635 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2636 | **/\r | |
2637 | RETURN_STATUS\r | |
2638 | EFIAPI\r | |
2639 | SafeIntnAdd (\r | |
2640 | IN INTN Augend,\r | |
2641 | IN INTN Addend,\r | |
2642 | OUT INTN *Result\r | |
2643 | );\r | |
2644 | \r | |
2645 | /**\r | |
2646 | INT64 Addition\r | |
2647 | \r | |
2648 | Performs the requested operation using the input parameters into a value\r | |
2649 | specified by Result type and stores the converted value into the caller\r | |
2650 | allocated output buffer specified by Result. The caller must pass in a\r | |
2651 | Result buffer that is at least as large as the Result type.\r | |
2652 | \r | |
2653 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2654 | \r | |
2655 | If the requested operation results in an overflow or an underflow condition,\r | |
2656 | then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2657 | \r | |
2658 | @param[in] Augend A number to which addend will be added\r | |
2659 | @param[in] Addend A number to be added to another\r | |
2660 | @param[out] Result Pointer to the result of addition\r | |
2661 | \r | |
2662 | @retval RETURN_SUCCESS Successful addition\r | |
2663 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2664 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2665 | **/\r | |
2666 | RETURN_STATUS\r | |
2667 | EFIAPI\r | |
2668 | SafeInt64Add (\r | |
2669 | IN INT64 Augend,\r | |
2670 | IN INT64 Addend,\r | |
2671 | OUT INT64 *Result\r | |
2672 | );\r | |
2673 | \r | |
2674 | //\r | |
2675 | // Signed subtraction functions\r | |
2676 | //\r | |
2677 | \r | |
2678 | /**\r | |
2679 | INT8 Subtraction\r | |
2680 | \r | |
2681 | Performs the requested operation using the input parameters into a value\r | |
2682 | specified by Result type and stores the converted value into the caller\r | |
2683 | allocated output buffer specified by Result. The caller must pass in a\r | |
2684 | Result buffer that is at least as large as the Result type.\r | |
2685 | \r | |
2686 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2687 | \r | |
2688 | If the requested operation results in an overflow or an underflow condition,\r | |
2689 | then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2690 | \r | |
2691 | @param[in] Minuend A number from which another is to be subtracted.\r | |
2692 | @param[in] Subtrahend A number to be subtracted from another\r | |
2693 | @param[out] Result Pointer to the result of subtraction\r | |
2694 | \r | |
2695 | @retval RETURN_SUCCESS Successful subtraction\r | |
2696 | @retval RETURN_BUFFER_TOO_SMALL Underflow\r | |
2697 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2698 | **/\r | |
2699 | RETURN_STATUS\r | |
2700 | EFIAPI\r | |
2701 | SafeInt8Sub (\r | |
2702 | IN INT8 Minuend,\r | |
2703 | IN INT8 Subtrahend,\r | |
2704 | OUT INT8 *Result\r | |
2705 | );\r | |
2706 | \r | |
2707 | /**\r | |
2708 | CHAR8 Subtraction\r | |
2709 | \r | |
2710 | Performs the requested operation using the input parameters into a value\r | |
2711 | specified by Result type and stores the converted value into the caller\r | |
2712 | allocated output buffer specified by Result. The caller must pass in a\r | |
2713 | Result buffer that is at least as large as the Result type.\r | |
2714 | \r | |
2715 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2716 | \r | |
2717 | If the requested operation results in an overflow or an underflow condition,\r | |
2718 | then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2719 | \r | |
2720 | @param[in] Minuend A number from which another is to be subtracted.\r | |
2721 | @param[in] Subtrahend A number to be subtracted from another\r | |
2722 | @param[out] Result Pointer to the result of subtraction\r | |
2723 | \r | |
2724 | @retval RETURN_SUCCESS Successful subtraction\r | |
2725 | @retval RETURN_BUFFER_TOO_SMALL Underflow\r | |
2726 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2727 | **/\r | |
2728 | RETURN_STATUS\r | |
2729 | EFIAPI\r | |
2730 | SafeChar8Sub (\r | |
2731 | IN CHAR8 Minuend,\r | |
2732 | IN CHAR8 Subtrahend,\r | |
2733 | OUT CHAR8 *Result\r | |
2734 | );\r | |
2735 | \r | |
2736 | /**\r | |
2737 | INT16 Subtraction\r | |
2738 | \r | |
2739 | Performs the requested operation using the input parameters into a value\r | |
2740 | specified by Result type and stores the converted value into the caller\r | |
2741 | allocated output buffer specified by Result. The caller must pass in a\r | |
2742 | Result buffer that is at least as large as the Result type.\r | |
2743 | \r | |
2744 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2745 | \r | |
2746 | If the requested operation results in an overflow or an underflow condition,\r | |
2747 | then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2748 | \r | |
2749 | @param[in] Minuend A number from which another is to be subtracted.\r | |
2750 | @param[in] Subtrahend A number to be subtracted from another\r | |
2751 | @param[out] Result Pointer to the result of subtraction\r | |
2752 | \r | |
2753 | @retval RETURN_SUCCESS Successful subtraction\r | |
2754 | @retval RETURN_BUFFER_TOO_SMALL Underflow\r | |
2755 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2756 | **/\r | |
2757 | RETURN_STATUS\r | |
2758 | EFIAPI\r | |
2759 | SafeInt16Sub (\r | |
2760 | IN INT16 Minuend,\r | |
2761 | IN INT16 Subtrahend,\r | |
2762 | OUT INT16 *Result\r | |
2763 | );\r | |
2764 | \r | |
2765 | /**\r | |
2766 | INT32 Subtraction\r | |
2767 | \r | |
2768 | Performs the requested operation using the input parameters into a value\r | |
2769 | specified by Result type and stores the converted value into the caller\r | |
2770 | allocated output buffer specified by Result. The caller must pass in a\r | |
2771 | Result buffer that is at least as large as the Result type.\r | |
2772 | \r | |
2773 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2774 | \r | |
2775 | If the requested operation results in an overflow or an underflow condition,\r | |
2776 | then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2777 | \r | |
2778 | @param[in] Minuend A number from which another is to be subtracted.\r | |
2779 | @param[in] Subtrahend A number to be subtracted from another\r | |
2780 | @param[out] Result Pointer to the result of subtraction\r | |
2781 | \r | |
2782 | @retval RETURN_SUCCESS Successful subtraction\r | |
2783 | @retval RETURN_BUFFER_TOO_SMALL Underflow\r | |
2784 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2785 | **/\r | |
2786 | RETURN_STATUS\r | |
2787 | EFIAPI\r | |
2788 | SafeInt32Sub (\r | |
2789 | IN INT32 Minuend,\r | |
2790 | IN INT32 Subtrahend,\r | |
2791 | OUT INT32 *Result\r | |
2792 | );\r | |
2793 | \r | |
2794 | /**\r | |
2795 | INTN Subtraction\r | |
2796 | \r | |
2797 | Performs the requested operation using the input parameters into a value\r | |
2798 | specified by Result type and stores the converted value into the caller\r | |
2799 | allocated output buffer specified by Result. The caller must pass in a\r | |
2800 | Result buffer that is at least as large as the Result type.\r | |
2801 | \r | |
2802 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2803 | \r | |
2804 | If the requested operation results in an overflow or an underflow condition,\r | |
2805 | then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2806 | \r | |
2807 | @param[in] Minuend A number from which another is to be subtracted.\r | |
2808 | @param[in] Subtrahend A number to be subtracted from another\r | |
2809 | @param[out] Result Pointer to the result of subtraction\r | |
2810 | \r | |
2811 | @retval RETURN_SUCCESS Successful subtraction\r | |
2812 | @retval RETURN_BUFFER_TOO_SMALL Underflow\r | |
2813 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2814 | **/\r | |
2815 | RETURN_STATUS\r | |
2816 | EFIAPI\r | |
2817 | SafeIntnSub (\r | |
2818 | IN INTN Minuend,\r | |
2819 | IN INTN Subtrahend,\r | |
2820 | OUT INTN *Result\r | |
2821 | );\r | |
2822 | \r | |
2823 | /**\r | |
2824 | INT64 Subtraction\r | |
2825 | \r | |
2826 | Performs the requested operation using the input parameters into a value\r | |
2827 | specified by Result type and stores the converted value into the caller\r | |
2828 | allocated output buffer specified by Result. The caller must pass in a\r | |
2829 | Result buffer that is at least as large as the Result type.\r | |
2830 | \r | |
2831 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2832 | \r | |
2833 | If the requested operation results in an overflow or an underflow condition,\r | |
2834 | then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2835 | \r | |
2836 | @param[in] Minuend A number from which another is to be subtracted.\r | |
2837 | @param[in] Subtrahend A number to be subtracted from another\r | |
2838 | @param[out] Result Pointer to the result of subtraction\r | |
2839 | \r | |
2840 | @retval RETURN_SUCCESS Successful subtraction\r | |
2841 | @retval RETURN_BUFFER_TOO_SMALL Underflow\r | |
2842 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2843 | **/\r | |
2844 | RETURN_STATUS\r | |
2845 | EFIAPI\r | |
2846 | SafeInt64Sub (\r | |
2847 | IN INT64 Minuend,\r | |
2848 | IN INT64 Subtrahend,\r | |
2849 | OUT INT64 *Result\r | |
2850 | );\r | |
2851 | \r | |
2852 | //\r | |
2853 | // Signed multiplication functions\r | |
2854 | //\r | |
2855 | \r | |
2856 | /**\r | |
2857 | INT8 multiplication\r | |
2858 | \r | |
2859 | Performs the requested operation using the input parameters into a value\r | |
2860 | specified by Result type and stores the converted value into the caller\r | |
2861 | allocated output buffer specified by Result. The caller must pass in a\r | |
2862 | Result buffer that is at least as large as the Result type.\r | |
2863 | \r | |
2864 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2865 | \r | |
2866 | If the requested operation results in an overflow or an underflow condition,\r | |
2867 | then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2868 | \r | |
2869 | @param[in] Multiplicand A number that is to be multiplied by another\r | |
2870 | @param[in] Multiplier A number by which the multiplicand is to be multiplied\r | |
2871 | @param[out] Result Pointer to the result of multiplication\r | |
2872 | \r | |
2873 | @retval RETURN_SUCCESS Successful multiplication\r | |
2874 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2875 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2876 | **/\r | |
2877 | RETURN_STATUS\r | |
2878 | EFIAPI\r | |
2879 | SafeInt8Mult (\r | |
2880 | IN INT8 Multiplicand,\r | |
2881 | IN INT8 Multiplier,\r | |
2882 | OUT INT8 *Result\r | |
2883 | );\r | |
2884 | \r | |
2885 | /**\r | |
2886 | CHAR8 multiplication\r | |
2887 | \r | |
2888 | Performs the requested operation using the input parameters into a value\r | |
2889 | specified by Result type and stores the converted value into the caller\r | |
2890 | allocated output buffer specified by Result. The caller must pass in a\r | |
2891 | Result buffer that is at least as large as the Result type.\r | |
2892 | \r | |
2893 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2894 | \r | |
2895 | If the requested operation results in an overflow or an underflow condition,\r | |
2896 | then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2897 | \r | |
2898 | @param[in] Multiplicand A number that is to be multiplied by another\r | |
2899 | @param[in] Multiplier A number by which the multiplicand is to be multiplied\r | |
2900 | @param[out] Result Pointer to the result of multiplication\r | |
2901 | \r | |
2902 | @retval RETURN_SUCCESS Successful multiplication\r | |
2903 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2904 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2905 | **/\r | |
2906 | RETURN_STATUS\r | |
2907 | EFIAPI\r | |
2908 | SafeChar8Mult (\r | |
2909 | IN CHAR8 Multiplicand,\r | |
2910 | IN CHAR8 Multiplier,\r | |
2911 | OUT CHAR8 *Result\r | |
2912 | );\r | |
2913 | \r | |
2914 | /**\r | |
2915 | INT16 multiplication\r | |
2916 | \r | |
2917 | Performs the requested operation using the input parameters into a value\r | |
2918 | specified by Result type and stores the converted value into the caller\r | |
2919 | allocated output buffer specified by Result. The caller must pass in a\r | |
2920 | Result buffer that is at least as large as the Result type.\r | |
2921 | \r | |
2922 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2923 | \r | |
2924 | If the requested operation results in an overflow or an underflow condition,\r | |
2925 | then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2926 | \r | |
2927 | @param[in] Multiplicand A number that is to be multiplied by another\r | |
2928 | @param[in] Multiplier A number by which the multiplicand is to be multiplied\r | |
2929 | @param[out] Result Pointer to the result of multiplication\r | |
2930 | \r | |
2931 | @retval RETURN_SUCCESS Successful multiplication\r | |
2932 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2933 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2934 | **/\r | |
2935 | RETURN_STATUS\r | |
2936 | EFIAPI\r | |
2937 | SafeInt16Mult (\r | |
2938 | IN INT16 Multiplicand,\r | |
2939 | IN INT16 Multiplier,\r | |
2940 | OUT INT16 *Result\r | |
2941 | );\r | |
2942 | \r | |
2943 | /**\r | |
2944 | INT32 multiplication\r | |
2945 | \r | |
2946 | Performs the requested operation using the input parameters into a value\r | |
2947 | specified by Result type and stores the converted value into the caller\r | |
2948 | allocated output buffer specified by Result. The caller must pass in a\r | |
2949 | Result buffer that is at least as large as the Result type.\r | |
2950 | \r | |
2951 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2952 | \r | |
2953 | If the requested operation results in an overflow or an underflow condition,\r | |
2954 | then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2955 | \r | |
2956 | @param[in] Multiplicand A number that is to be multiplied by another\r | |
2957 | @param[in] Multiplier A number by which the multiplicand is to be multiplied\r | |
2958 | @param[out] Result Pointer to the result of multiplication\r | |
2959 | \r | |
2960 | @retval RETURN_SUCCESS Successful multiplication\r | |
2961 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2962 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2963 | **/\r | |
2964 | RETURN_STATUS\r | |
2965 | EFIAPI\r | |
2966 | SafeInt32Mult (\r | |
2967 | IN INT32 Multiplicand,\r | |
2968 | IN INT32 Multiplier,\r | |
2969 | OUT INT32 *Result\r | |
2970 | );\r | |
2971 | \r | |
2972 | /**\r | |
2973 | INTN multiplication\r | |
2974 | \r | |
2975 | Performs the requested operation using the input parameters into a value\r | |
2976 | specified by Result type and stores the converted value into the caller\r | |
2977 | allocated output buffer specified by Result. The caller must pass in a\r | |
2978 | Result buffer that is at least as large as the Result type.\r | |
2979 | \r | |
2980 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
2981 | \r | |
2982 | If the requested operation results in an overflow or an underflow condition,\r | |
2983 | then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
2984 | \r | |
2985 | @param[in] Multiplicand A number that is to be multiplied by another\r | |
2986 | @param[in] Multiplier A number by which the multiplicand is to be multiplied\r | |
2987 | @param[out] Result Pointer to the result of multiplication\r | |
2988 | \r | |
2989 | @retval RETURN_SUCCESS Successful multiplication\r | |
2990 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
2991 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
2992 | **/\r | |
2993 | RETURN_STATUS\r | |
2994 | EFIAPI\r | |
2995 | SafeIntnMult (\r | |
2996 | IN INTN Multiplicand,\r | |
2997 | IN INTN Multiplier,\r | |
2998 | OUT INTN *Result\r | |
2999 | );\r | |
3000 | \r | |
3001 | /**\r | |
3002 | INT64 multiplication\r | |
3003 | \r | |
3004 | Performs the requested operation using the input parameters into a value\r | |
3005 | specified by Result type and stores the converted value into the caller\r | |
3006 | allocated output buffer specified by Result. The caller must pass in a\r | |
3007 | Result buffer that is at least as large as the Result type.\r | |
3008 | \r | |
3009 | If Result is NULL, RETURN_INVALID_PARAMETER is returned.\r | |
3010 | \r | |
3011 | If the requested operation results in an overflow or an underflow condition,\r | |
3012 | then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.\r | |
3013 | \r | |
3014 | @param[in] Multiplicand A number that is to be multiplied by another\r | |
3015 | @param[in] Multiplier A number by which the multiplicand is to be multiplied\r | |
3016 | @param[out] Result Pointer to the result of multiplication\r | |
3017 | \r | |
3018 | @retval RETURN_SUCCESS Successful multiplication\r | |
3019 | @retval RETURN_BUFFER_TOO_SMALL Overflow\r | |
3020 | @retval RETURN_INVALID_PARAMETER Result is NULL\r | |
3021 | **/\r | |
3022 | RETURN_STATUS\r | |
3023 | EFIAPI\r | |
3024 | SafeInt64Mult (\r | |
3025 | IN INT64 Multiplicand,\r | |
3026 | IN INT64 Multiplier,\r | |
3027 | OUT INT64 *Result\r | |
3028 | );\r | |
3029 | \r | |
3030 | #endif // __INT_SAFE_LIB_H__\r |