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