]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/SafeIntLib.h
2 This library provides helper functions to prevent integer overflow during
3 type conversion, addition, subtraction, and multiplication.
5 Copyright (c) 2017, Microsoft Corporation
8 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #ifndef __INT_SAFE_LIB_H__
12 #define __INT_SAFE_LIB_H__
15 // It is common for -1 to be used as an error value
17 #define INT8_ERROR ((INT8) -1)
18 #define UINT8_ERROR MAX_UINT8
19 #define CHAR8_ERROR ((CHAR8)(MAX_INT8))
20 #define INT16_ERROR ((INT16) -1)
21 #define UINT16_ERROR MAX_UINT16
22 #define CHAR16_ERROR MAX_UINT16
23 #define INT32_ERROR ((INT32) -1)
24 #define UINT32_ERROR MAX_UINT32
25 #define INT64_ERROR ((INT64) -1)
26 #define UINT64_ERROR MAX_UINT64
27 #define INTN_ERROR ((INTN) -1)
28 #define UINTN_ERROR MAX_UINTN
31 // CHAR16 is defined to be the same as UINT16, so for CHAR16
32 // operations redirect to the UINT16 ones:
34 #define SafeInt8ToChar16 SafeInt8ToUint16
35 #define SafeInt16ToChar16 SafeInt16ToUint16
36 #define SafeInt32ToChar16 SafeInt32ToUint16
37 #define SafeUint32ToChar16 SafeUint32ToUint16
38 #define SafeInt64ToChar16 SafeInt64ToUint16
39 #define SafeUint64ToChar16 SafeUint64ToUint16
40 #define SafeIntnToChar16 SafeIntnToUint16
41 #define SafeUintnToChar16 SafeUintnToUint16
43 #define SafeChar16ToInt8 SafeUint16ToInt8
44 #define SafeChar16ToUint8 SafeUint16ToUint8
45 #define SafeChar16ToChar8 SafeUint16ToChar8
46 #define SafeChar16ToInt16 SafeUint16ToInt16
48 #define SafeChar16Mult SafeUint16Mult
49 #define SafeChar16Sub SafeUint16Sub
50 #define SafeChar16Add SafeUint16Add
53 // Conversion functions
55 // There are three reasons for having conversion functions:
57 // 1. We are converting from a signed type to an unsigned type of the same
58 // size, or vice-versa.
60 // 2. We are converting to a smaller type, and we could therefore possibly
63 // 3. We are converting to a bigger type, and we are signed and the type we are
64 // converting to is unsigned.
68 INT8 -> UINT8 conversion
70 Converts the value specified by Operand to a value specified by Result type
71 and stores the converted value into the caller allocated output buffer
72 specified by Result. The caller must pass in a Result buffer that is at
73 least as large as the Result type.
75 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
77 If the conversion results in an overflow or an underflow condition, then
78 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
80 @param[in] Operand Operand to be converted to new type
81 @param[out] Result Pointer to the result of conversion
83 @retval RETURN_SUCCESS Successful conversion
84 @retval RETURN_BUFFER_TOO_SMALL Overflow
85 @retval RETURN_INVALID_PARAMETER Result is NULL
95 INT8 -> CHAR8 conversion
97 Converts the value specified by Operand to a value specified by Result type
98 and stores the converted value into the caller allocated output buffer
99 specified by Result. The caller must pass in a Result buffer that is at
100 least as large as the Result type.
102 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
104 If the conversion results in an overflow or an underflow condition, then
105 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
107 @param[in] Operand Operand to be converted to new type
108 @param[out] Result Pointer to the result of conversion
110 @retval RETURN_SUCCESS Successful conversion
111 @retval RETURN_BUFFER_TOO_SMALL Overflow
112 @retval RETURN_INVALID_PARAMETER Result is NULL
122 INT8 -> UINT16 conversion
124 Converts the value specified by Operand to a value specified by Result type
125 and stores the converted value into the caller allocated output buffer
126 specified by Result. The caller must pass in a Result buffer that is at
127 least as large as the Result type.
129 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
131 If the conversion results in an overflow or an underflow condition, then
132 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
134 @param[in] Operand Operand to be converted to new type
135 @param[out] Result Pointer to the result of conversion
137 @retval RETURN_SUCCESS Successful conversion
138 @retval RETURN_BUFFER_TOO_SMALL Overflow
139 @retval RETURN_INVALID_PARAMETER Result is NULL
149 INT8 -> UINT32 conversion
151 Converts the value specified by Operand to a value specified by Result type
152 and stores the converted value into the caller allocated output buffer
153 specified by Result. The caller must pass in a Result buffer that is at
154 least as large as the Result type.
156 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
158 If the conversion results in an overflow or an underflow condition, then
159 Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
161 @param[in] Operand Operand to be converted to new type
162 @param[out] Result Pointer to the result of conversion
164 @retval RETURN_SUCCESS Successful conversion
165 @retval RETURN_BUFFER_TOO_SMALL Overflow
166 @retval RETURN_INVALID_PARAMETER Result is NULL
176 INT8 -> UINTN conversion
178 Converts the value specified by Operand to a value specified by Result type
179 and stores the converted value into the caller allocated output buffer
180 specified by Result. The caller must pass in a Result buffer that is at
181 least as large as the Result type.
183 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
185 If the conversion results in an overflow or an underflow condition, then
186 Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
188 @param[in] Operand Operand to be converted to new type
189 @param[out] Result Pointer to the result of conversion
191 @retval RETURN_SUCCESS Successful conversion
192 @retval RETURN_BUFFER_TOO_SMALL Overflow
193 @retval RETURN_INVALID_PARAMETER Result is NULL
203 INT8 -> UINT64 conversion
205 Converts the value specified by Operand to a value specified by Result type
206 and stores the converted value into the caller allocated output buffer
207 specified by Result. The caller must pass in a Result buffer that is at
208 least as large as the Result type.
210 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
212 If the conversion results in an overflow or an underflow condition, then
213 Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
215 @param[in] Operand Operand to be converted to new type
216 @param[out] Result Pointer to the result of conversion
218 @retval RETURN_SUCCESS Successful conversion
219 @retval RETURN_BUFFER_TOO_SMALL Overflow
220 @retval RETURN_INVALID_PARAMETER Result is NULL
230 UINT8 -> INT8 conversion
232 Converts the value specified by Operand to a value specified by Result type
233 and stores the converted value into the caller allocated output buffer
234 specified by Result. The caller must pass in a Result buffer that is at
235 least as large as the Result type.
237 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
239 If the conversion results in an overflow or an underflow condition, then
240 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
242 @param[in] Operand Operand to be converted to new type
243 @param[out] Result Pointer to the result of conversion
245 @retval RETURN_SUCCESS Successful conversion
246 @retval RETURN_BUFFER_TOO_SMALL Overflow
247 @retval RETURN_INVALID_PARAMETER Result is NULL
257 UINT8 -> CHAR8 conversion
259 Converts the value specified by Operand to a value specified by Result type
260 and stores the converted value into the caller allocated output buffer
261 specified by Result. The caller must pass in a Result buffer that is at
262 least as large as the Result type.
264 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
266 If the conversion results in an overflow or an underflow condition, then
267 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
269 @param[in] Operand Operand to be converted to new type
270 @param[out] Result Pointer to the result of conversion
272 @retval RETURN_SUCCESS Successful conversion
273 @retval RETURN_BUFFER_TOO_SMALL Overflow
274 @retval RETURN_INVALID_PARAMETER Result is NULL
284 INT16 -> INT8 conversion
286 Converts the value specified by Operand to a value specified by Result type
287 and stores the converted value into the caller allocated output buffer
288 specified by Result. The caller must pass in a Result buffer that is at
289 least as large as the Result type.
291 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
293 If the conversion results in an overflow or an underflow condition, then
294 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
296 @param[in] Operand Operand to be converted to new type
297 @param[out] Result Pointer to the result of conversion
299 @retval RETURN_SUCCESS Successful conversion
300 @retval RETURN_BUFFER_TOO_SMALL Overflow
301 @retval RETURN_INVALID_PARAMETER Result is NULL
311 INT16 -> CHAR8 conversion
313 Converts the value specified by Operand to a value specified by Result type
314 and stores the converted value into the caller allocated output buffer
315 specified by Result. The caller must pass in a Result buffer that is at
316 least as large as the Result type.
318 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
320 If the conversion results in an overflow or an underflow condition, then
321 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
323 @param[in] Operand Operand to be converted to new type
324 @param[out] Result Pointer to the result of conversion
326 @retval RETURN_SUCCESS Successful conversion
327 @retval RETURN_BUFFER_TOO_SMALL Overflow
328 @retval RETURN_INVALID_PARAMETER Result is NULL
338 INT16 -> UINT8 conversion
340 Converts the value specified by Operand to a value specified by Result type
341 and stores the converted value into the caller allocated output buffer
342 specified by Result. The caller must pass in a Result buffer that is at
343 least as large as the Result type.
345 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
347 If the conversion results in an overflow or an underflow condition, then
348 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
350 @param[in] Operand Operand to be converted to new type
351 @param[out] Result Pointer to the result of conversion
353 @retval RETURN_SUCCESS Successful conversion
354 @retval RETURN_BUFFER_TOO_SMALL Overflow
355 @retval RETURN_INVALID_PARAMETER Result is NULL
365 INT16 -> UINT16 conversion
367 Converts the value specified by Operand to a value specified by Result type
368 and stores the converted value into the caller allocated output buffer
369 specified by Result. The caller must pass in a Result buffer that is at
370 least as large as the Result type.
372 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
374 If the conversion results in an overflow or an underflow condition, then
375 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
377 @param[in] Operand Operand to be converted to new type
378 @param[out] Result Pointer to the result of conversion
380 @retval RETURN_SUCCESS Successful conversion
381 @retval RETURN_BUFFER_TOO_SMALL Overflow
382 @retval RETURN_INVALID_PARAMETER Result is NULL
392 INT16 -> UINT32 conversion
394 Converts the value specified by Operand to a value specified by Result type
395 and stores the converted value into the caller allocated output buffer
396 specified by Result. The caller must pass in a Result buffer that is at
397 least as large as the Result type.
399 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
401 If the conversion results in an overflow or an underflow condition, then
402 Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
404 @param[in] Operand Operand to be converted to new type
405 @param[out] Result Pointer to the result of conversion
407 @retval RETURN_SUCCESS Successful conversion
408 @retval RETURN_BUFFER_TOO_SMALL Overflow
409 @retval RETURN_INVALID_PARAMETER Result is NULL
419 INT16 -> UINTN conversion
421 Converts the value specified by Operand to a value specified by Result type
422 and stores the converted value into the caller allocated output buffer
423 specified by Result. The caller must pass in a Result buffer that is at
424 least as large as the Result type.
426 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
428 If the conversion results in an overflow or an underflow condition, then
429 Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
431 @param[in] Operand Operand to be converted to new type
432 @param[out] Result Pointer to the result of conversion
434 @retval RETURN_SUCCESS Successful conversion
435 @retval RETURN_BUFFER_TOO_SMALL Overflow
436 @retval RETURN_INVALID_PARAMETER Result is NULL
446 INT16 -> UINT64 conversion
448 Converts the value specified by Operand to a value specified by Result type
449 and stores the converted value into the caller allocated output buffer
450 specified by Result. The caller must pass in a Result buffer that is at
451 least as large as the Result type.
453 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
455 If the conversion results in an overflow or an underflow condition, then
456 Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
458 @param[in] Operand Operand to be converted to new type
459 @param[out] Result Pointer to the result of conversion
461 @retval RETURN_SUCCESS Successful conversion
462 @retval RETURN_BUFFER_TOO_SMALL Overflow
463 @retval RETURN_INVALID_PARAMETER Result is NULL
473 UINT16 -> INT8 conversion
475 Converts the value specified by Operand to a value specified by Result type
476 and stores the converted value into the caller allocated output buffer
477 specified by Result. The caller must pass in a Result buffer that is at
478 least as large as the Result type.
480 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
482 If the conversion results in an overflow or an underflow condition, then
483 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
485 @param[in] Operand Operand to be converted to new type
486 @param[out] Result Pointer to the result of conversion
488 @retval RETURN_SUCCESS Successful conversion
489 @retval RETURN_BUFFER_TOO_SMALL Overflow
490 @retval RETURN_INVALID_PARAMETER Result is NULL
500 UINT16 -> CHAR8 conversion
502 Converts the value specified by Operand to a value specified by Result type
503 and stores the converted value into the caller allocated output buffer
504 specified by Result. The caller must pass in a Result buffer that is at
505 least as large as the Result type.
507 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
509 If the conversion results in an overflow or an underflow condition, then
510 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
512 @param[in] Operand Operand to be converted to new type
513 @param[out] Result Pointer to the result of conversion
515 @retval RETURN_SUCCESS Successful conversion
516 @retval RETURN_BUFFER_TOO_SMALL Overflow
517 @retval RETURN_INVALID_PARAMETER Result is NULL
527 UINT16 -> UINT8 conversion
529 Converts the value specified by Operand to a value specified by Result type
530 and stores the converted value into the caller allocated output buffer
531 specified by Result. The caller must pass in a Result buffer that is at
532 least as large as the Result type.
534 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
536 If the conversion results in an overflow or an underflow condition, then
537 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
539 @param[in] Operand Operand to be converted to new type
540 @param[out] Result Pointer to the result of conversion
542 @retval RETURN_SUCCESS Successful conversion
543 @retval RETURN_BUFFER_TOO_SMALL Overflow
544 @retval RETURN_INVALID_PARAMETER Result is NULL
554 UINT16 -> INT16 conversion
556 Converts the value specified by Operand to a value specified by Result type
557 and stores the converted value into the caller allocated output buffer
558 specified by Result. The caller must pass in a Result buffer that is at
559 least as large as the Result type.
561 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
563 If the conversion results in an overflow or an underflow condition, then
564 Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
566 @param[in] Operand Operand to be converted to new type
567 @param[out] Result Pointer to the result of conversion
569 @retval RETURN_SUCCESS Successful conversion
570 @retval RETURN_BUFFER_TOO_SMALL Overflow
571 @retval RETURN_INVALID_PARAMETER Result is NULL
581 INT32 -> INT8 conversion
583 Converts the value specified by Operand to a value specified by Result type
584 and stores the converted value into the caller allocated output buffer
585 specified by Result. The caller must pass in a Result buffer that is at
586 least as large as the Result type.
588 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
590 If the conversion results in an overflow or an underflow condition, then
591 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
593 @param[in] Operand Operand to be converted to new type
594 @param[out] Result Pointer to the result of conversion
596 @retval RETURN_SUCCESS Successful conversion
597 @retval RETURN_BUFFER_TOO_SMALL Overflow
598 @retval RETURN_INVALID_PARAMETER Result is NULL
608 INT32 -> CHAR8 conversion
610 Converts the value specified by Operand to a value specified by Result type
611 and stores the converted value into the caller allocated output buffer
612 specified by Result. The caller must pass in a Result buffer that is at
613 least as large as the Result type.
615 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
617 If the conversion results in an overflow or an underflow condition, then
618 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
620 @param[in] Operand Operand to be converted to new type
621 @param[out] Result Pointer to the result of conversion
623 @retval RETURN_SUCCESS Successful conversion
624 @retval RETURN_BUFFER_TOO_SMALL Overflow
625 @retval RETURN_INVALID_PARAMETER Result is NULL
635 INT32 -> UINT8 conversion
637 Converts the value specified by Operand to a value specified by Result type
638 and stores the converted value into the caller allocated output buffer
639 specified by Result. The caller must pass in a Result buffer that is at
640 least as large as the Result type.
642 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
644 If the conversion results in an overflow or an underflow condition, then
645 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
647 @param[in] Operand Operand to be converted to new type
648 @param[out] Result Pointer to the result of conversion
650 @retval RETURN_SUCCESS Successful conversion
651 @retval RETURN_BUFFER_TOO_SMALL Overflow
652 @retval RETURN_INVALID_PARAMETER Result is NULL
662 INT32 -> INT16 conversion
664 Converts the value specified by Operand to a value specified by Result type
665 and stores the converted value into the caller allocated output buffer
666 specified by Result. The caller must pass in a Result buffer that is at
667 least as large as the Result type.
669 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
671 If the conversion results in an overflow or an underflow condition, then
672 Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
674 @param[in] Operand Operand to be converted to new type
675 @param[out] Result Pointer to the result of conversion
677 @retval RETURN_SUCCESS Successful conversion
678 @retval RETURN_BUFFER_TOO_SMALL Overflow
679 @retval RETURN_INVALID_PARAMETER Result is NULL
689 INT32 -> UINT16 conversion
691 Converts the value specified by Operand to a value specified by Result type
692 and stores the converted value into the caller allocated output buffer
693 specified by Result. The caller must pass in a Result buffer that is at
694 least as large as the Result type.
696 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
698 If the conversion results in an overflow or an underflow condition, then
699 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
701 @param[in] Operand Operand to be converted to new type
702 @param[out] Result Pointer to the result of conversion
704 @retval RETURN_SUCCESS Successful conversion
705 @retval RETURN_BUFFER_TOO_SMALL Overflow
706 @retval RETURN_INVALID_PARAMETER Result is NULL
717 INT32 -> UINT32 conversion
719 Converts the value specified by Operand to a value specified by Result type
720 and stores the converted value into the caller allocated output buffer
721 specified by Result. The caller must pass in a Result buffer that is at
722 least as large as the Result type.
724 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
726 If the conversion results in an overflow or an underflow condition, then
727 Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
729 @param[in] Operand Operand to be converted to new type
730 @param[out] Result Pointer to the result of conversion
732 @retval RETURN_SUCCESS Successful conversion
733 @retval RETURN_BUFFER_TOO_SMALL Overflow
734 @retval RETURN_INVALID_PARAMETER Result is NULL
744 INT32 -> UINTN conversion
746 Converts the value specified by Operand to a value specified by Result type
747 and stores the converted value into the caller allocated output buffer
748 specified by Result. The caller must pass in a Result buffer that is at
749 least as large as the Result type.
751 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
753 If the conversion results in an overflow or an underflow condition, then
754 Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
756 @param[in] Operand Operand to be converted to new type
757 @param[out] Result Pointer to the result of conversion
759 @retval RETURN_SUCCESS Successful conversion
760 @retval RETURN_BUFFER_TOO_SMALL Overflow
761 @retval RETURN_INVALID_PARAMETER Result is NULL
771 INT32 -> UINT64 conversion
773 Converts the value specified by Operand to a value specified by Result type
774 and stores the converted value into the caller allocated output buffer
775 specified by Result. The caller must pass in a Result buffer that is at
776 least as large as the Result type.
778 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
780 If the conversion results in an overflow or an underflow condition, then
781 Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
783 @param[in] Operand Operand to be converted to new type
784 @param[out] Result Pointer to the result of conversion
786 @retval RETURN_SUCCESS Successful conversion
787 @retval RETURN_BUFFER_TOO_SMALL Overflow
788 @retval RETURN_INVALID_PARAMETER Result is NULL
798 UINT32 -> INT8 conversion
800 Converts the value specified by Operand to a value specified by Result type
801 and stores the converted value into the caller allocated output buffer
802 specified by Result. The caller must pass in a Result buffer that is at
803 least as large as the Result type.
805 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
807 If the conversion results in an overflow or an underflow condition, then
808 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
810 @param[in] Operand Operand to be converted to new type
811 @param[out] Result Pointer to the result of conversion
813 @retval RETURN_SUCCESS Successful conversion
814 @retval RETURN_BUFFER_TOO_SMALL Overflow
815 @retval RETURN_INVALID_PARAMETER Result is NULL
825 UINT32 -> CHAR8 conversion
827 Converts the value specified by Operand to a value specified by Result type
828 and stores the converted value into the caller allocated output buffer
829 specified by Result. The caller must pass in a Result buffer that is at
830 least as large as the Result type.
832 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
834 If the conversion results in an overflow or an underflow condition, then
835 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
837 @param[in] Operand Operand to be converted to new type
838 @param[out] Result Pointer to the result of conversion
840 @retval RETURN_SUCCESS Successful conversion
841 @retval RETURN_BUFFER_TOO_SMALL Overflow
842 @retval RETURN_INVALID_PARAMETER Result is NULL
852 UINT32 -> UINT8 conversion
854 Converts the value specified by Operand to a value specified by Result type
855 and stores the converted value into the caller allocated output buffer
856 specified by Result. The caller must pass in a Result buffer that is at
857 least as large as the Result type.
859 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
861 If the conversion results in an overflow or an underflow condition, then
862 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
864 @param[in] Operand Operand to be converted to new type
865 @param[out] Result Pointer to the result of conversion
867 @retval RETURN_SUCCESS Successful conversion
868 @retval RETURN_BUFFER_TOO_SMALL Overflow
869 @retval RETURN_INVALID_PARAMETER Result is NULL
879 UINT32 -> INT16 conversion
881 Converts the value specified by Operand to a value specified by Result type
882 and stores the converted value into the caller allocated output buffer
883 specified by Result. The caller must pass in a Result buffer that is at
884 least as large as the Result type.
886 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
888 If the conversion results in an overflow or an underflow condition, then
889 Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
891 @param[in] Operand Operand to be converted to new type
892 @param[out] Result Pointer to the result of conversion
894 @retval RETURN_SUCCESS Successful conversion
895 @retval RETURN_BUFFER_TOO_SMALL Overflow
896 @retval RETURN_INVALID_PARAMETER Result is NULL
906 UINT32 -> UINT16 conversion
908 Converts the value specified by Operand to a value specified by Result type
909 and stores the converted value into the caller allocated output buffer
910 specified by Result. The caller must pass in a Result buffer that is at
911 least as large as the Result type.
913 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
915 If the conversion results in an overflow or an underflow condition, then
916 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
918 @param[in] Operand Operand to be converted to new type
919 @param[out] Result Pointer to the result of conversion
921 @retval RETURN_SUCCESS Successful conversion
922 @retval RETURN_BUFFER_TOO_SMALL Overflow
923 @retval RETURN_INVALID_PARAMETER Result is NULL
933 UINT32 -> INT32 conversion
935 Converts the value specified by Operand to a value specified by Result type
936 and stores the converted value into the caller allocated output buffer
937 specified by Result. The caller must pass in a Result buffer that is at
938 least as large as the Result type.
940 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
942 If the conversion results in an overflow or an underflow condition, then
943 Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
945 @param[in] Operand Operand to be converted to new type
946 @param[out] Result Pointer to the result of conversion
948 @retval RETURN_SUCCESS Successful conversion
949 @retval RETURN_BUFFER_TOO_SMALL Overflow
950 @retval RETURN_INVALID_PARAMETER Result is NULL
960 UINT32 -> INTN conversion
962 Converts the value specified by Operand to a value specified by Result type
963 and stores the converted value into the caller allocated output buffer
964 specified by Result. The caller must pass in a Result buffer that is at
965 least as large as the Result type.
967 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
969 If the conversion results in an overflow or an underflow condition, then
970 Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
972 @param[in] Operand Operand to be converted to new type
973 @param[out] Result Pointer to the result of conversion
975 @retval RETURN_SUCCESS Successful conversion
976 @retval RETURN_BUFFER_TOO_SMALL Overflow
977 @retval RETURN_INVALID_PARAMETER Result is NULL
987 INTN -> INT8 conversion
989 Converts the value specified by Operand to a value specified by Result type
990 and stores the converted value into the caller allocated output buffer
991 specified by Result. The caller must pass in a Result buffer that is at
992 least as large as the Result type.
994 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
996 If the conversion results in an overflow or an underflow condition, then
997 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
999 @param[in] Operand Operand to be converted to new type
1000 @param[out] Result Pointer to the result of conversion
1002 @retval RETURN_SUCCESS Successful conversion
1003 @retval RETURN_BUFFER_TOO_SMALL Overflow
1004 @retval RETURN_INVALID_PARAMETER Result is NULL
1014 INTN -> CHAR8 conversion
1016 Converts the value specified by Operand to a value specified by Result type
1017 and stores the converted value into the caller allocated output buffer
1018 specified by Result. The caller must pass in a Result buffer that is at
1019 least as large as the Result type.
1021 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1023 If the conversion results in an overflow or an underflow condition, then
1024 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1026 @param[in] Operand Operand to be converted to new type
1027 @param[out] Result Pointer to the result of conversion
1029 @retval RETURN_SUCCESS Successful conversion
1030 @retval RETURN_BUFFER_TOO_SMALL Overflow
1031 @retval RETURN_INVALID_PARAMETER Result is NULL
1041 INTN -> UINT8 conversion
1043 Converts the value specified by Operand to a value specified by Result type
1044 and stores the converted value into the caller allocated output buffer
1045 specified by Result. The caller must pass in a Result buffer that is at
1046 least as large as the Result type.
1048 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1050 If the conversion results in an overflow or an underflow condition, then
1051 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1053 @param[in] Operand Operand to be converted to new type
1054 @param[out] Result Pointer to the result of conversion
1056 @retval RETURN_SUCCESS Successful conversion
1057 @retval RETURN_BUFFER_TOO_SMALL Overflow
1058 @retval RETURN_INVALID_PARAMETER Result is NULL
1068 INTN -> INT16 conversion
1070 Converts the value specified by Operand to a value specified by Result type
1071 and stores the converted value into the caller allocated output buffer
1072 specified by Result. The caller must pass in a Result buffer that is at
1073 least as large as the Result type.
1075 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1077 If the conversion results in an overflow or an underflow condition, then
1078 Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1080 @param[in] Operand Operand to be converted to new type
1081 @param[out] Result Pointer to the result of conversion
1083 @retval RETURN_SUCCESS Successful conversion
1084 @retval RETURN_BUFFER_TOO_SMALL Overflow
1085 @retval RETURN_INVALID_PARAMETER Result is NULL
1095 INTN -> UINT16 conversion
1097 Converts the value specified by Operand to a value specified by Result type
1098 and stores the converted value into the caller allocated output buffer
1099 specified by Result. The caller must pass in a Result buffer that is at
1100 least as large as the Result type.
1102 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1104 If the conversion results in an overflow or an underflow condition, then
1105 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1107 @param[in] Operand Operand to be converted to new type
1108 @param[out] Result Pointer to the result of conversion
1110 @retval RETURN_SUCCESS Successful conversion
1111 @retval RETURN_BUFFER_TOO_SMALL Overflow
1112 @retval RETURN_INVALID_PARAMETER Result is NULL
1122 INTN -> INT32 conversion
1124 Converts the value specified by Operand to a value specified by Result type
1125 and stores the converted value into the caller allocated output buffer
1126 specified by Result. The caller must pass in a Result buffer that is at
1127 least as large as the Result type.
1129 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1131 If the conversion results in an overflow or an underflow condition, then
1132 Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1134 @param[in] Operand Operand to be converted to new type
1135 @param[out] Result Pointer to the result of conversion
1137 @retval RETURN_SUCCESS Successful conversion
1138 @retval RETURN_BUFFER_TOO_SMALL Overflow
1139 @retval RETURN_INVALID_PARAMETER Result is NULL
1149 INTN -> UINT32 conversion
1151 Converts the value specified by Operand to a value specified by Result type
1152 and stores the converted value into the caller allocated output buffer
1153 specified by Result. The caller must pass in a Result buffer that is at
1154 least as large as the Result type.
1156 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1158 If the conversion results in an overflow or an underflow condition, then
1159 Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1161 @param[in] Operand Operand to be converted to new type
1162 @param[out] Result Pointer to the result of conversion
1164 @retval RETURN_SUCCESS Successful conversion
1165 @retval RETURN_BUFFER_TOO_SMALL Overflow
1166 @retval RETURN_INVALID_PARAMETER Result is NULL
1176 INTN -> UINTN conversion
1178 Converts the value specified by Operand to a value specified by Result type
1179 and stores the converted value into the caller allocated output buffer
1180 specified by Result. The caller must pass in a Result buffer that is at
1181 least as large as the Result type.
1183 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1185 If the conversion results in an overflow or an underflow condition, then
1186 Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1188 @param[in] Operand Operand to be converted to new type
1189 @param[out] Result Pointer to the result of conversion
1191 @retval RETURN_SUCCESS Successful conversion
1192 @retval RETURN_BUFFER_TOO_SMALL Overflow
1193 @retval RETURN_INVALID_PARAMETER Result is NULL
1203 INTN -> UINT64 conversion
1205 Converts the value specified by Operand to a value specified by Result type
1206 and stores the converted value into the caller allocated output buffer
1207 specified by Result. The caller must pass in a Result buffer that is at
1208 least as large as the Result type.
1210 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1212 If the conversion results in an overflow or an underflow condition, then
1213 Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1215 @param[in] Operand Operand to be converted to new type
1216 @param[out] Result Pointer to the result of conversion
1218 @retval RETURN_SUCCESS Successful conversion
1219 @retval RETURN_BUFFER_TOO_SMALL Overflow
1220 @retval RETURN_INVALID_PARAMETER Result is NULL
1230 UINTN -> INT8 conversion
1232 Converts the value specified by Operand to a value specified by Result type
1233 and stores the converted value into the caller allocated output buffer
1234 specified by Result. The caller must pass in a Result buffer that is at
1235 least as large as the Result type.
1237 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1239 If the conversion results in an overflow or an underflow condition, then
1240 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1242 @param[in] Operand Operand to be converted to new type
1243 @param[out] Result Pointer to the result of conversion
1245 @retval RETURN_SUCCESS Successful conversion
1246 @retval RETURN_BUFFER_TOO_SMALL Overflow
1247 @retval RETURN_INVALID_PARAMETER Result is NULL
1257 UINTN -> CHAR8 conversion
1259 Converts the value specified by Operand to a value specified by Result type
1260 and stores the converted value into the caller allocated output buffer
1261 specified by Result. The caller must pass in a Result buffer that is at
1262 least as large as the Result type.
1264 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1266 If the conversion results in an overflow or an underflow condition, then
1267 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1269 @param[in] Operand Operand to be converted to new type
1270 @param[out] Result Pointer to the result of conversion
1272 @retval RETURN_SUCCESS Successful conversion
1273 @retval RETURN_BUFFER_TOO_SMALL Overflow
1274 @retval RETURN_INVALID_PARAMETER Result is NULL
1284 UINTN -> UINT8 conversion
1286 Converts the value specified by Operand to a value specified by Result type
1287 and stores the converted value into the caller allocated output buffer
1288 specified by Result. The caller must pass in a Result buffer that is at
1289 least as large as the Result type.
1291 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1293 If the conversion results in an overflow or an underflow condition, then
1294 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1296 @param[in] Operand Operand to be converted to new type
1297 @param[out] Result Pointer to the result of conversion
1299 @retval RETURN_SUCCESS Successful conversion
1300 @retval RETURN_BUFFER_TOO_SMALL Overflow
1301 @retval RETURN_INVALID_PARAMETER Result is NULL
1311 UINTN -> INT16 conversion
1313 Converts the value specified by Operand to a value specified by Result type
1314 and stores the converted value into the caller allocated output buffer
1315 specified by Result. The caller must pass in a Result buffer that is at
1316 least as large as the Result type.
1318 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1320 If the conversion results in an overflow or an underflow condition, then
1321 Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1323 @param[in] Operand Operand to be converted to new type
1324 @param[out] Result Pointer to the result of conversion
1326 @retval RETURN_SUCCESS Successful conversion
1327 @retval RETURN_BUFFER_TOO_SMALL Overflow
1328 @retval RETURN_INVALID_PARAMETER Result is NULL
1338 UINTN -> UINT16 conversion
1340 Converts the value specified by Operand to a value specified by Result type
1341 and stores the converted value into the caller allocated output buffer
1342 specified by Result. The caller must pass in a Result buffer that is at
1343 least as large as the Result type.
1345 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1347 If the conversion results in an overflow or an underflow condition, then
1348 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1350 @param[in] Operand Operand to be converted to new type
1351 @param[out] Result Pointer to the result of conversion
1353 @retval RETURN_SUCCESS Successful conversion
1354 @retval RETURN_BUFFER_TOO_SMALL Overflow
1355 @retval RETURN_INVALID_PARAMETER Result is NULL
1365 UINTN -> INT32 conversion
1367 Converts the value specified by Operand to a value specified by Result type
1368 and stores the converted value into the caller allocated output buffer
1369 specified by Result. The caller must pass in a Result buffer that is at
1370 least as large as the Result type.
1372 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1374 If the conversion results in an overflow or an underflow condition, then
1375 Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1377 @param[in] Operand Operand to be converted to new type
1378 @param[out] Result Pointer to the result of conversion
1380 @retval RETURN_SUCCESS Successful conversion
1381 @retval RETURN_BUFFER_TOO_SMALL Overflow
1382 @retval RETURN_INVALID_PARAMETER Result is NULL
1392 UINTN -> UINT32 conversion
1394 Converts the value specified by Operand to a value specified by Result type
1395 and stores the converted value into the caller allocated output buffer
1396 specified by Result. The caller must pass in a Result buffer that is at
1397 least as large as the Result type.
1399 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1401 If the conversion results in an overflow or an underflow condition, then
1402 Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1404 @param[in] Operand Operand to be converted to new type
1405 @param[out] Result Pointer to the result of conversion
1407 @retval RETURN_SUCCESS Successful conversion
1408 @retval RETURN_BUFFER_TOO_SMALL Overflow
1409 @retval RETURN_INVALID_PARAMETER Result is NULL
1419 UINTN -> INTN conversion
1421 Converts the value specified by Operand to a value specified by Result type
1422 and stores the converted value into the caller allocated output buffer
1423 specified by Result. The caller must pass in a Result buffer that is at
1424 least as large as the Result type.
1426 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1428 If the conversion results in an overflow or an underflow condition, then
1429 Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1431 @param[in] Operand Operand to be converted to new type
1432 @param[out] Result Pointer to the result of conversion
1434 @retval RETURN_SUCCESS Successful conversion
1435 @retval RETURN_BUFFER_TOO_SMALL Overflow
1436 @retval RETURN_INVALID_PARAMETER Result is NULL
1446 UINTN -> INT64 conversion
1448 Converts the value specified by Operand to a value specified by Result type
1449 and stores the converted value into the caller allocated output buffer
1450 specified by Result. The caller must pass in a Result buffer that is at
1451 least as large as the Result type.
1453 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1455 If the conversion results in an overflow or an underflow condition, then
1456 Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1458 @param[in] Operand Operand to be converted to new type
1459 @param[out] Result Pointer to the result of conversion
1461 @retval RETURN_SUCCESS Successful conversion
1462 @retval RETURN_BUFFER_TOO_SMALL Overflow
1463 @retval RETURN_INVALID_PARAMETER Result is NULL
1473 INT64 -> INT8 conversion
1475 Converts the value specified by Operand to a value specified by Result type
1476 and stores the converted value into the caller allocated output buffer
1477 specified by Result. The caller must pass in a Result buffer that is at
1478 least as large as the Result type.
1480 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1482 If the conversion results in an overflow or an underflow condition, then
1483 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1485 @param[in] Operand Operand to be converted to new type
1486 @param[out] Result Pointer to the result of conversion
1488 @retval RETURN_SUCCESS Successful conversion
1489 @retval RETURN_BUFFER_TOO_SMALL Overflow
1490 @retval RETURN_INVALID_PARAMETER Result is NULL
1500 INT64 -> CHAR8 conversion
1502 Converts the value specified by Operand to a value specified by Result type
1503 and stores the converted value into the caller allocated output buffer
1504 specified by Result. The caller must pass in a Result buffer that is at
1505 least as large as the Result type.
1507 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1509 If the conversion results in an overflow or an underflow condition, then
1510 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1512 @param[in] Operand Operand to be converted to new type
1513 @param[out] Result Pointer to the result of conversion
1515 @retval RETURN_SUCCESS Successful conversion
1516 @retval RETURN_BUFFER_TOO_SMALL Overflow
1517 @retval RETURN_INVALID_PARAMETER Result is NULL
1527 INT64 -> UINT8 conversion
1529 Converts the value specified by Operand to a value specified by Result type
1530 and stores the converted value into the caller allocated output buffer
1531 specified by Result. The caller must pass in a Result buffer that is at
1532 least as large as the Result type.
1534 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1536 If the conversion results in an overflow or an underflow condition, then
1537 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1539 @param[in] Operand Operand to be converted to new type
1540 @param[out] Result Pointer to the result of conversion
1542 @retval RETURN_SUCCESS Successful conversion
1543 @retval RETURN_BUFFER_TOO_SMALL Overflow
1544 @retval RETURN_INVALID_PARAMETER Result is NULL
1554 INT64 -> INT16 conversion
1556 Converts the value specified by Operand to a value specified by Result type
1557 and stores the converted value into the caller allocated output buffer
1558 specified by Result. The caller must pass in a Result buffer that is at
1559 least as large as the Result type.
1561 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1563 If the conversion results in an overflow or an underflow condition, then
1564 Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1566 @param[in] Operand Operand to be converted to new type
1567 @param[out] Result Pointer to the result of conversion
1569 @retval RETURN_SUCCESS Successful conversion
1570 @retval RETURN_BUFFER_TOO_SMALL Overflow
1571 @retval RETURN_INVALID_PARAMETER Result is NULL
1581 INT64 -> UINT16 conversion
1583 Converts the value specified by Operand to a value specified by Result type
1584 and stores the converted value into the caller allocated output buffer
1585 specified by Result. The caller must pass in a Result buffer that is at
1586 least as large as the Result type.
1588 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1590 If the conversion results in an overflow or an underflow condition, then
1591 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1593 @param[in] Operand Operand to be converted to new type
1594 @param[out] Result Pointer to the result of conversion
1596 @retval RETURN_SUCCESS Successful conversion
1597 @retval RETURN_BUFFER_TOO_SMALL Overflow
1598 @retval RETURN_INVALID_PARAMETER Result is NULL
1608 INT64 -> INT32 conversion
1610 Converts the value specified by Operand to a value specified by Result type
1611 and stores the converted value into the caller allocated output buffer
1612 specified by Result. The caller must pass in a Result buffer that is at
1613 least as large as the Result type.
1615 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1617 If the conversion results in an overflow or an underflow condition, then
1618 Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1620 @param[in] Operand Operand to be converted to new type
1621 @param[out] Result Pointer to the result of conversion
1623 @retval RETURN_SUCCESS Successful conversion
1624 @retval RETURN_BUFFER_TOO_SMALL Overflow
1625 @retval RETURN_INVALID_PARAMETER Result is NULL
1635 INT64 -> UINT32 conversion
1637 Converts the value specified by Operand to a value specified by Result type
1638 and stores the converted value into the caller allocated output buffer
1639 specified by Result. The caller must pass in a Result buffer that is at
1640 least as large as the Result type.
1642 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1644 If the conversion results in an overflow or an underflow condition, then
1645 Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1647 @param[in] Operand Operand to be converted to new type
1648 @param[out] Result Pointer to the result of conversion
1650 @retval RETURN_SUCCESS Successful conversion
1651 @retval RETURN_BUFFER_TOO_SMALL Overflow
1652 @retval RETURN_INVALID_PARAMETER Result is NULL
1662 INT64 -> INTN conversion
1664 Converts the value specified by Operand to a value specified by Result type
1665 and stores the converted value into the caller allocated output buffer
1666 specified by Result. The caller must pass in a Result buffer that is at
1667 least as large as the Result type.
1669 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1671 If the conversion results in an overflow or an underflow condition, then
1672 Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1674 @param[in] Operand Operand to be converted to new type
1675 @param[out] Result Pointer to the result of conversion
1677 @retval RETURN_SUCCESS Successful conversion
1678 @retval RETURN_BUFFER_TOO_SMALL Overflow
1679 @retval RETURN_INVALID_PARAMETER Result is NULL
1689 INT64 -> UINTN conversion
1691 Converts the value specified by Operand to a value specified by Result type
1692 and stores the converted value into the caller allocated output buffer
1693 specified by Result. The caller must pass in a Result buffer that is at
1694 least as large as the Result type.
1696 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1698 If the conversion results in an overflow or an underflow condition, then
1699 Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1701 @param[in] Operand Operand to be converted to new type
1702 @param[out] Result Pointer to the result of conversion
1704 @retval RETURN_SUCCESS Successful conversion
1705 @retval RETURN_BUFFER_TOO_SMALL Overflow
1706 @retval RETURN_INVALID_PARAMETER Result is NULL
1716 INT64 -> UINT64 conversion
1718 Converts the value specified by Operand to a value specified by Result type
1719 and stores the converted value into the caller allocated output buffer
1720 specified by Result. The caller must pass in a Result buffer that is at
1721 least as large as the Result type.
1723 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1725 If the conversion results in an overflow or an underflow condition, then
1726 Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1728 @param[in] Operand Operand to be converted to new type
1729 @param[out] Result Pointer to the result of conversion
1731 @retval RETURN_SUCCESS Successful conversion
1732 @retval RETURN_BUFFER_TOO_SMALL Overflow
1733 @retval RETURN_INVALID_PARAMETER Result is NULL
1743 UINT64 -> INT8 conversion
1745 Converts the value specified by Operand to a value specified by Result type
1746 and stores the converted value into the caller allocated output buffer
1747 specified by Result. The caller must pass in a Result buffer that is at
1748 least as large as the Result type.
1750 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1752 If the conversion results in an overflow or an underflow condition, then
1753 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1755 @param[in] Operand Operand to be converted to new type
1756 @param[out] Result Pointer to the result of conversion
1758 @retval RETURN_SUCCESS Successful conversion
1759 @retval RETURN_BUFFER_TOO_SMALL Overflow
1760 @retval RETURN_INVALID_PARAMETER Result is NULL
1770 UINT64 -> CHAR8 conversion
1772 Converts the value specified by Operand to a value specified by Result type
1773 and stores the converted value into the caller allocated output buffer
1774 specified by Result. The caller must pass in a Result buffer that is at
1775 least as large as the Result type.
1777 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1779 If the conversion results in an overflow or an underflow condition, then
1780 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1782 @param[in] Operand Operand to be converted to new type
1783 @param[out] Result Pointer to the result of conversion
1785 @retval RETURN_SUCCESS Successful conversion
1786 @retval RETURN_BUFFER_TOO_SMALL Overflow
1787 @retval RETURN_INVALID_PARAMETER Result is NULL
1797 UINT64 -> UINT8 conversion
1799 Converts the value specified by Operand to a value specified by Result type
1800 and stores the converted value into the caller allocated output buffer
1801 specified by Result. The caller must pass in a Result buffer that is at
1802 least as large as the Result type.
1804 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1806 If the conversion results in an overflow or an underflow condition, then
1807 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1809 @param[in] Operand Operand to be converted to new type
1810 @param[out] Result Pointer to the result of conversion
1812 @retval RETURN_SUCCESS Successful conversion
1813 @retval RETURN_BUFFER_TOO_SMALL Overflow
1814 @retval RETURN_INVALID_PARAMETER Result is NULL
1824 UINT64 -> INT16 conversion
1826 Converts the value specified by Operand to a value specified by Result type
1827 and stores the converted value into the caller allocated output buffer
1828 specified by Result. The caller must pass in a Result buffer that is at
1829 least as large as the Result type.
1831 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1833 If the conversion results in an overflow or an underflow condition, then
1834 Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1836 @param[in] Operand Operand to be converted to new type
1837 @param[out] Result Pointer to the result of conversion
1839 @retval RETURN_SUCCESS Successful conversion
1840 @retval RETURN_BUFFER_TOO_SMALL Overflow
1841 @retval RETURN_INVALID_PARAMETER Result is NULL
1851 UINT64 -> UINT16 conversion
1853 Converts the value specified by Operand to a value specified by Result type
1854 and stores the converted value into the caller allocated output buffer
1855 specified by Result. The caller must pass in a Result buffer that is at
1856 least as large as the Result type.
1858 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1860 If the conversion results in an overflow or an underflow condition, then
1861 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1863 @param[in] Operand Operand to be converted to new type
1864 @param[out] Result Pointer to the result of conversion
1866 @retval RETURN_SUCCESS Successful conversion
1867 @retval RETURN_BUFFER_TOO_SMALL Overflow
1868 @retval RETURN_INVALID_PARAMETER Result is NULL
1872 SafeUint64ToUint16 (
1878 UINT64 -> INT32 conversion
1880 Converts the value specified by Operand to a value specified by Result type
1881 and stores the converted value into the caller allocated output buffer
1882 specified by Result. The caller must pass in a Result buffer that is at
1883 least as large as the Result type.
1885 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1887 If the conversion results in an overflow or an underflow condition, then
1888 Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1890 @param[in] Operand Operand to be converted to new type
1891 @param[out] Result Pointer to the result of conversion
1893 @retval RETURN_SUCCESS Successful conversion
1894 @retval RETURN_BUFFER_TOO_SMALL Overflow
1895 @retval RETURN_INVALID_PARAMETER Result is NULL
1905 UINT64 -> UINT32 conversion
1907 Converts the value specified by Operand to a value specified by Result type
1908 and stores the converted value into the caller allocated output buffer
1909 specified by Result. The caller must pass in a Result buffer that is at
1910 least as large as the Result type.
1912 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1914 If the conversion results in an overflow or an underflow condition, then
1915 Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1917 @param[in] Operand Operand to be converted to new type
1918 @param[out] Result Pointer to the result of conversion
1920 @retval RETURN_SUCCESS Successful conversion
1921 @retval RETURN_BUFFER_TOO_SMALL Overflow
1922 @retval RETURN_INVALID_PARAMETER Result is NULL
1926 SafeUint64ToUint32 (
1932 UINT64 -> INTN conversion
1934 Converts the value specified by Operand to a value specified by Result type
1935 and stores the converted value into the caller allocated output buffer
1936 specified by Result. The caller must pass in a Result buffer that is at
1937 least as large as the Result type.
1939 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1941 If the conversion results in an overflow or an underflow condition, then
1942 Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1944 @param[in] Operand Operand to be converted to new type
1945 @param[out] Result Pointer to the result of conversion
1947 @retval RETURN_SUCCESS Successful conversion
1948 @retval RETURN_BUFFER_TOO_SMALL Overflow
1949 @retval RETURN_INVALID_PARAMETER Result is NULL
1959 UINT64 -> UINTN conversion
1961 Converts the value specified by Operand to a value specified by Result type
1962 and stores the converted value into the caller allocated output buffer
1963 specified by Result. The caller must pass in a Result buffer that is at
1964 least as large as the Result type.
1966 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1968 If the conversion results in an overflow or an underflow condition, then
1969 Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1971 @param[in] Operand Operand to be converted to new type
1972 @param[out] Result Pointer to the result of conversion
1974 @retval RETURN_SUCCESS Successful conversion
1975 @retval RETURN_BUFFER_TOO_SMALL Overflow
1976 @retval RETURN_INVALID_PARAMETER Result is NULL
1986 UINT64 -> INT64 conversion
1988 Converts the value specified by Operand to a value specified by Result type
1989 and stores the converted value into the caller allocated output buffer
1990 specified by Result. The caller must pass in a Result buffer that is at
1991 least as large as the Result type.
1993 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1995 If the conversion results in an overflow or an underflow condition, then
1996 Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1998 @param[in] Operand Operand to be converted to new type
1999 @param[out] Result Pointer to the result of conversion
2001 @retval RETURN_SUCCESS Successful conversion
2002 @retval RETURN_BUFFER_TOO_SMALL Overflow
2003 @retval RETURN_INVALID_PARAMETER Result is NULL
2013 // Addition functions
2019 Performs the requested operation using the input parameters into a value
2020 specified by Result type and stores the converted value into the caller
2021 allocated output buffer specified by Result. The caller must pass in a
2022 Result buffer that is at least as large as the Result type.
2024 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2026 If the requested operation results in an overflow or an underflow condition,
2027 then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2029 @param[in] Augend A number to which addend will be added
2030 @param[in] Addend A number to be added to another
2031 @param[out] Result Pointer to the result of addition
2033 @retval RETURN_SUCCESS Successful addition
2034 @retval RETURN_BUFFER_TOO_SMALL Overflow
2035 @retval RETURN_INVALID_PARAMETER Result is NULL
2048 Performs the requested operation using the input parameters into a value
2049 specified by Result type and stores the converted value into the caller
2050 allocated output buffer specified by Result. The caller must pass in a
2051 Result buffer that is at least as large as the Result type.
2053 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2055 If the requested operation results in an overflow or an underflow condition,
2056 then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2058 @param[in] Augend A number to which addend will be added
2059 @param[in] Addend A number to be added to another
2060 @param[out] Result Pointer to the result of addition
2062 @retval RETURN_SUCCESS Successful addition
2063 @retval RETURN_BUFFER_TOO_SMALL Overflow
2064 @retval RETURN_INVALID_PARAMETER Result is NULL
2077 Performs the requested operation using the input parameters into a value
2078 specified by Result type and stores the converted value into the caller
2079 allocated output buffer specified by Result. The caller must pass in a
2080 Result buffer that is at least as large as the Result type.
2082 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2084 If the requested operation results in an overflow or an underflow condition,
2085 then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2087 @param[in] Augend A number to which addend will be added
2088 @param[in] Addend A number to be added to another
2089 @param[out] Result Pointer to the result of addition
2091 @retval RETURN_SUCCESS Successful addition
2092 @retval RETURN_BUFFER_TOO_SMALL Overflow
2093 @retval RETURN_INVALID_PARAMETER Result is NULL
2106 Performs the requested operation using the input parameters into a value
2107 specified by Result type and stores the converted value into the caller
2108 allocated output buffer specified by Result. The caller must pass in a
2109 Result buffer that is at least as large as the Result type.
2111 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2113 If the requested operation results in an overflow or an underflow condition,
2114 then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2116 @param[in] Augend A number to which addend will be added
2117 @param[in] Addend A number to be added to another
2118 @param[out] Result Pointer to the result of addition
2120 @retval RETURN_SUCCESS Successful addition
2121 @retval RETURN_BUFFER_TOO_SMALL Overflow
2122 @retval RETURN_INVALID_PARAMETER Result is NULL
2135 Performs the requested operation using the input parameters into a value
2136 specified by Result type and stores the converted value into the caller
2137 allocated output buffer specified by Result. The caller must pass in a
2138 Result buffer that is at least as large as the Result type.
2140 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2142 If the requested operation results in an overflow or an underflow condition,
2143 then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2145 @param[in] Augend A number to which addend will be added
2146 @param[in] Addend A number to be added to another
2147 @param[out] Result Pointer to the result of addition
2149 @retval RETURN_SUCCESS Successful addition
2150 @retval RETURN_BUFFER_TOO_SMALL Overflow
2151 @retval RETURN_INVALID_PARAMETER Result is NULL
2162 // Subtraction functions
2168 Performs the requested operation using the input parameters into a value
2169 specified by Result type and stores the converted value into the caller
2170 allocated output buffer specified by Result. The caller must pass in a
2171 Result buffer that is at least as large as the Result type.
2173 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2175 If the requested operation results in an overflow or an underflow condition,
2176 then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2178 @param[in] Minuend A number from which another is to be subtracted.
2179 @param[in] Subtrahend A number to be subtracted from another
2180 @param[out] Result Pointer to the result of subtraction
2182 @retval RETURN_SUCCESS Successful subtraction
2183 @retval RETURN_BUFFER_TOO_SMALL Underflow
2184 @retval RETURN_INVALID_PARAMETER Result is NULL
2190 IN UINT8 Subtrahend
,
2197 Performs the requested operation using the input parameters into a value
2198 specified by Result type and stores the converted value into the caller
2199 allocated output buffer specified by Result. The caller must pass in a
2200 Result buffer that is at least as large as the Result type.
2202 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2204 If the requested operation results in an overflow or an underflow condition,
2205 then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2207 @param[in] Minuend A number from which another is to be subtracted.
2208 @param[in] Subtrahend A number to be subtracted from another
2209 @param[out] Result Pointer to the result of subtraction
2211 @retval RETURN_SUCCESS Successful subtraction
2212 @retval RETURN_BUFFER_TOO_SMALL Underflow
2213 @retval RETURN_INVALID_PARAMETER Result is NULL
2219 IN UINT16 Subtrahend
,
2226 Performs the requested operation using the input parameters into a value
2227 specified by Result type and stores the converted value into the caller
2228 allocated output buffer specified by Result. The caller must pass in a
2229 Result buffer that is at least as large as the Result type.
2231 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2233 If the requested operation results in an overflow or an underflow condition,
2234 then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2236 @param[in] Minuend A number from which another is to be subtracted.
2237 @param[in] Subtrahend A number to be subtracted from another
2238 @param[out] Result Pointer to the result of subtraction
2240 @retval RETURN_SUCCESS Successful subtraction
2241 @retval RETURN_BUFFER_TOO_SMALL Underflow
2242 @retval RETURN_INVALID_PARAMETER Result is NULL
2248 IN UINT32 Subtrahend
,
2255 Performs the requested operation using the input parameters into a value
2256 specified by Result type and stores the converted value into the caller
2257 allocated output buffer specified by Result. The caller must pass in a
2258 Result buffer that is at least as large as the Result type.
2260 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2262 If the requested operation results in an overflow or an underflow condition,
2263 then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2265 @param[in] Minuend A number from which another is to be subtracted.
2266 @param[in] Subtrahend A number to be subtracted from another
2267 @param[out] Result Pointer to the result of subtraction
2269 @retval RETURN_SUCCESS Successful subtraction
2270 @retval RETURN_BUFFER_TOO_SMALL Underflow
2271 @retval RETURN_INVALID_PARAMETER Result is NULL
2277 IN UINTN Subtrahend
,
2284 Performs the requested operation using the input parameters into a value
2285 specified by Result type and stores the converted value into the caller
2286 allocated output buffer specified by Result. The caller must pass in a
2287 Result buffer that is at least as large as the Result type.
2289 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2291 If the requested operation results in an overflow or an underflow condition,
2292 then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2294 @param[in] Minuend A number from which another is to be subtracted.
2295 @param[in] Subtrahend A number to be subtracted from another
2296 @param[out] Result Pointer to the result of subtraction
2298 @retval RETURN_SUCCESS Successful subtraction
2299 @retval RETURN_BUFFER_TOO_SMALL Underflow
2300 @retval RETURN_INVALID_PARAMETER Result is NULL
2306 IN UINT64 Subtrahend
,
2311 // Multiplication functions
2315 UINT8 multiplication
2317 Performs the requested operation using the input parameters into a value
2318 specified by Result type and stores the converted value into the caller
2319 allocated output buffer specified by Result. The caller must pass in a
2320 Result buffer that is at least as large as the Result type.
2322 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2324 If the requested operation results in an overflow or an underflow condition,
2325 then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2327 @param[in] Multiplicand A number that is to be multiplied by another
2328 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2329 @param[out] Result Pointer to the result of multiplication
2331 @retval RETURN_SUCCESS Successful multiplication
2332 @retval RETURN_BUFFER_TOO_SMALL Overflow
2333 @retval RETURN_INVALID_PARAMETER Result is NULL
2338 IN UINT8 Multiplicand
,
2339 IN UINT8 Multiplier
,
2344 UINT16 multiplication
2346 Performs the requested operation using the input parameters into a value
2347 specified by Result type and stores the converted value into the caller
2348 allocated output buffer specified by Result. The caller must pass in a
2349 Result buffer that is at least as large as the Result type.
2351 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2353 If the requested operation results in an overflow or an underflow condition,
2354 then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2356 @param[in] Multiplicand A number that is to be multiplied by another
2357 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2358 @param[out] Result Pointer to the result of multiplication
2360 @retval RETURN_SUCCESS Successful multiplication
2361 @retval RETURN_BUFFER_TOO_SMALL Overflow
2362 @retval RETURN_INVALID_PARAMETER Result is NULL
2367 IN UINT16 Multiplicand
,
2368 IN UINT16 Multiplier
,
2373 UINT32 multiplication
2375 Performs the requested operation using the input parameters into a value
2376 specified by Result type and stores the converted value into the caller
2377 allocated output buffer specified by Result. The caller must pass in a
2378 Result buffer that is at least as large as the Result type.
2380 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2382 If the requested operation results in an overflow or an underflow condition,
2383 then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2385 @param[in] Multiplicand A number that is to be multiplied by another
2386 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2387 @param[out] Result Pointer to the result of multiplication
2389 @retval RETURN_SUCCESS Successful multiplication
2390 @retval RETURN_BUFFER_TOO_SMALL Overflow
2391 @retval RETURN_INVALID_PARAMETER Result is NULL
2396 IN UINT32 Multiplicand
,
2397 IN UINT32 Multiplier
,
2402 UINTN multiplication
2404 Performs the requested operation using the input parameters into a value
2405 specified by Result type and stores the converted value into the caller
2406 allocated output buffer specified by Result. The caller must pass in a
2407 Result buffer that is at least as large as the Result type.
2409 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2411 If the requested operation results in an overflow or an underflow condition,
2412 then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2414 @param[in] Multiplicand A number that is to be multiplied by another
2415 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2416 @param[out] Result Pointer to the result of multiplication
2418 @retval RETURN_SUCCESS Successful multiplication
2419 @retval RETURN_BUFFER_TOO_SMALL Overflow
2420 @retval RETURN_INVALID_PARAMETER Result is NULL
2425 IN UINTN Multiplicand
,
2426 IN UINTN Multiplier
,
2431 UINT64 multiplication
2433 Performs the requested operation using the input parameters into a value
2434 specified by Result type and stores the converted value into the caller
2435 allocated output buffer specified by Result. The caller must pass in a
2436 Result buffer that is at least as large as the Result type.
2438 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2440 If the requested operation results in an overflow or an underflow condition,
2441 then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2443 @param[in] Multiplicand A number that is to be multiplied by another
2444 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2445 @param[out] Result Pointer to the result of multiplication
2447 @retval RETURN_SUCCESS Successful multiplication
2448 @retval RETURN_BUFFER_TOO_SMALL Overflow
2449 @retval RETURN_INVALID_PARAMETER Result is NULL
2454 IN UINT64 Multiplicand
,
2455 IN UINT64 Multiplier
,
2460 // Signed operations
2462 // Strongly consider using unsigned numbers.
2464 // Signed numbers are often used where unsigned numbers should be used.
2465 // For example file sizes and array indices should always be unsigned.
2466 // Subtracting a larger positive signed number from a smaller positive
2467 // signed number with SafeInt32Sub will succeed, producing a negative number,
2468 // that then must not be used as an array index (but can occasionally be
2469 // used as a pointer index.) Similarly for adding a larger magnitude
2470 // negative number to a smaller magnitude positive number.
2472 // This library does not protect you from such errors. It tells you if your
2473 // integer operations overflowed, not if you are doing the right thing
2474 // with your non-overflowed integers.
2476 // Likewise you can overflow a buffer with a non-overflowed unsigned index.
2480 // Signed addition functions
2486 Performs the requested operation using the input parameters into a value
2487 specified by Result type and stores the converted value into the caller
2488 allocated output buffer specified by Result. The caller must pass in a
2489 Result buffer that is at least as large as the Result type.
2491 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2493 If the requested operation results in an overflow or an underflow condition,
2494 then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2496 @param[in] Augend A number to which addend will be added
2497 @param[in] Addend A number to be added to another
2498 @param[out] Result Pointer to the result of addition
2500 @retval RETURN_SUCCESS Successful addition
2501 @retval RETURN_BUFFER_TOO_SMALL Overflow
2502 @retval RETURN_INVALID_PARAMETER Result is NULL
2515 Performs the requested operation using the input parameters into a value
2516 specified by Result type and stores the converted value into the caller
2517 allocated output buffer specified by Result. The caller must pass in a
2518 Result buffer that is at least as large as the Result type.
2520 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2522 If the requested operation results in an overflow or an underflow condition,
2523 then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2525 @param[in] Augend A number to which addend will be added
2526 @param[in] Addend A number to be added to another
2527 @param[out] Result Pointer to the result of addition
2529 @retval RETURN_SUCCESS Successful addition
2530 @retval RETURN_BUFFER_TOO_SMALL Overflow
2531 @retval RETURN_INVALID_PARAMETER Result is NULL
2544 Performs the requested operation using the input parameters into a value
2545 specified by Result type and stores the converted value into the caller
2546 allocated output buffer specified by Result. The caller must pass in a
2547 Result buffer that is at least as large as the Result type.
2549 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2551 If the requested operation results in an overflow or an underflow condition,
2552 then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2554 @param[in] Augend A number to which addend will be added
2555 @param[in] Addend A number to be added to another
2556 @param[out] Result Pointer to the result of addition
2558 @retval RETURN_SUCCESS Successful addition
2559 @retval RETURN_BUFFER_TOO_SMALL Overflow
2560 @retval RETURN_INVALID_PARAMETER Result is NULL
2573 Performs the requested operation using the input parameters into a value
2574 specified by Result type and stores the converted value into the caller
2575 allocated output buffer specified by Result. The caller must pass in a
2576 Result buffer that is at least as large as the Result type.
2578 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2580 If the requested operation results in an overflow or an underflow condition,
2581 then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2583 @param[in] Augend A number to which addend will be added
2584 @param[in] Addend A number to be added to another
2585 @param[out] Result Pointer to the result of addition
2587 @retval RETURN_SUCCESS Successful addition
2588 @retval RETURN_BUFFER_TOO_SMALL Overflow
2589 @retval RETURN_INVALID_PARAMETER Result is NULL
2602 Performs the requested operation using the input parameters into a value
2603 specified by Result type and stores the converted value into the caller
2604 allocated output buffer specified by Result. The caller must pass in a
2605 Result buffer that is at least as large as the Result type.
2607 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2609 If the requested operation results in an overflow or an underflow condition,
2610 then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2612 @param[in] Augend A number to which addend will be added
2613 @param[in] Addend A number to be added to another
2614 @param[out] Result Pointer to the result of addition
2616 @retval RETURN_SUCCESS Successful addition
2617 @retval RETURN_BUFFER_TOO_SMALL Overflow
2618 @retval RETURN_INVALID_PARAMETER Result is NULL
2631 Performs the requested operation using the input parameters into a value
2632 specified by Result type and stores the converted value into the caller
2633 allocated output buffer specified by Result. The caller must pass in a
2634 Result buffer that is at least as large as the Result type.
2636 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2638 If the requested operation results in an overflow or an underflow condition,
2639 then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2641 @param[in] Augend A number to which addend will be added
2642 @param[in] Addend A number to be added to another
2643 @param[out] Result Pointer to the result of addition
2645 @retval RETURN_SUCCESS Successful addition
2646 @retval RETURN_BUFFER_TOO_SMALL Overflow
2647 @retval RETURN_INVALID_PARAMETER Result is NULL
2658 // Signed subtraction functions
2664 Performs the requested operation using the input parameters into a value
2665 specified by Result type and stores the converted value into the caller
2666 allocated output buffer specified by Result. The caller must pass in a
2667 Result buffer that is at least as large as the Result type.
2669 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2671 If the requested operation results in an overflow or an underflow condition,
2672 then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2674 @param[in] Minuend A number from which another is to be subtracted.
2675 @param[in] Subtrahend A number to be subtracted from another
2676 @param[out] Result Pointer to the result of subtraction
2678 @retval RETURN_SUCCESS Successful subtraction
2679 @retval RETURN_BUFFER_TOO_SMALL Underflow
2680 @retval RETURN_INVALID_PARAMETER Result is NULL
2693 Performs the requested operation using the input parameters into a value
2694 specified by Result type and stores the converted value into the caller
2695 allocated output buffer specified by Result. The caller must pass in a
2696 Result buffer that is at least as large as the Result type.
2698 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2700 If the requested operation results in an overflow or an underflow condition,
2701 then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2703 @param[in] Minuend A number from which another is to be subtracted.
2704 @param[in] Subtrahend A number to be subtracted from another
2705 @param[out] Result Pointer to the result of subtraction
2707 @retval RETURN_SUCCESS Successful subtraction
2708 @retval RETURN_BUFFER_TOO_SMALL Underflow
2709 @retval RETURN_INVALID_PARAMETER Result is NULL
2715 IN CHAR8 Subtrahend
,
2722 Performs the requested operation using the input parameters into a value
2723 specified by Result type and stores the converted value into the caller
2724 allocated output buffer specified by Result. The caller must pass in a
2725 Result buffer that is at least as large as the Result type.
2727 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2729 If the requested operation results in an overflow or an underflow condition,
2730 then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2732 @param[in] Minuend A number from which another is to be subtracted.
2733 @param[in] Subtrahend A number to be subtracted from another
2734 @param[out] Result Pointer to the result of subtraction
2736 @retval RETURN_SUCCESS Successful subtraction
2737 @retval RETURN_BUFFER_TOO_SMALL Underflow
2738 @retval RETURN_INVALID_PARAMETER Result is NULL
2744 IN INT16 Subtrahend
,
2751 Performs the requested operation using the input parameters into a value
2752 specified by Result type and stores the converted value into the caller
2753 allocated output buffer specified by Result. The caller must pass in a
2754 Result buffer that is at least as large as the Result type.
2756 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2758 If the requested operation results in an overflow or an underflow condition,
2759 then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2761 @param[in] Minuend A number from which another is to be subtracted.
2762 @param[in] Subtrahend A number to be subtracted from another
2763 @param[out] Result Pointer to the result of subtraction
2765 @retval RETURN_SUCCESS Successful subtraction
2766 @retval RETURN_BUFFER_TOO_SMALL Underflow
2767 @retval RETURN_INVALID_PARAMETER Result is NULL
2773 IN INT32 Subtrahend
,
2780 Performs the requested operation using the input parameters into a value
2781 specified by Result type and stores the converted value into the caller
2782 allocated output buffer specified by Result. The caller must pass in a
2783 Result buffer that is at least as large as the Result type.
2785 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2787 If the requested operation results in an overflow or an underflow condition,
2788 then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2790 @param[in] Minuend A number from which another is to be subtracted.
2791 @param[in] Subtrahend A number to be subtracted from another
2792 @param[out] Result Pointer to the result of subtraction
2794 @retval RETURN_SUCCESS Successful subtraction
2795 @retval RETURN_BUFFER_TOO_SMALL Underflow
2796 @retval RETURN_INVALID_PARAMETER Result is NULL
2809 Performs the requested operation using the input parameters into a value
2810 specified by Result type and stores the converted value into the caller
2811 allocated output buffer specified by Result. The caller must pass in a
2812 Result buffer that is at least as large as the Result type.
2814 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2816 If the requested operation results in an overflow or an underflow condition,
2817 then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2819 @param[in] Minuend A number from which another is to be subtracted.
2820 @param[in] Subtrahend A number to be subtracted from another
2821 @param[out] Result Pointer to the result of subtraction
2823 @retval RETURN_SUCCESS Successful subtraction
2824 @retval RETURN_BUFFER_TOO_SMALL Underflow
2825 @retval RETURN_INVALID_PARAMETER Result is NULL
2831 IN INT64 Subtrahend
,
2836 // Signed multiplication functions
2842 Performs the requested operation using the input parameters into a value
2843 specified by Result type and stores the converted value into the caller
2844 allocated output buffer specified by Result. The caller must pass in a
2845 Result buffer that is at least as large as the Result type.
2847 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2849 If the requested operation results in an overflow or an underflow condition,
2850 then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2852 @param[in] Multiplicand A number that is to be multiplied by another
2853 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2854 @param[out] Result Pointer to the result of multiplication
2856 @retval RETURN_SUCCESS Successful multiplication
2857 @retval RETURN_BUFFER_TOO_SMALL Overflow
2858 @retval RETURN_INVALID_PARAMETER Result is NULL
2863 IN INT8 Multiplicand
,
2869 CHAR8 multiplication
2871 Performs the requested operation using the input parameters into a value
2872 specified by Result type and stores the converted value into the caller
2873 allocated output buffer specified by Result. The caller must pass in a
2874 Result buffer that is at least as large as the Result type.
2876 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2878 If the requested operation results in an overflow or an underflow condition,
2879 then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2881 @param[in] Multiplicand A number that is to be multiplied by another
2882 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2883 @param[out] Result Pointer to the result of multiplication
2885 @retval RETURN_SUCCESS Successful multiplication
2886 @retval RETURN_BUFFER_TOO_SMALL Overflow
2887 @retval RETURN_INVALID_PARAMETER Result is NULL
2892 IN CHAR8 Multiplicand
,
2893 IN CHAR8 Multiplier
,
2898 INT16 multiplication
2900 Performs the requested operation using the input parameters into a value
2901 specified by Result type and stores the converted value into the caller
2902 allocated output buffer specified by Result. The caller must pass in a
2903 Result buffer that is at least as large as the Result type.
2905 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2907 If the requested operation results in an overflow or an underflow condition,
2908 then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2910 @param[in] Multiplicand A number that is to be multiplied by another
2911 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2912 @param[out] Result Pointer to the result of multiplication
2914 @retval RETURN_SUCCESS Successful multiplication
2915 @retval RETURN_BUFFER_TOO_SMALL Overflow
2916 @retval RETURN_INVALID_PARAMETER Result is NULL
2921 IN INT16 Multiplicand
,
2922 IN INT16 Multiplier
,
2927 INT32 multiplication
2929 Performs the requested operation using the input parameters into a value
2930 specified by Result type and stores the converted value into the caller
2931 allocated output buffer specified by Result. The caller must pass in a
2932 Result buffer that is at least as large as the Result type.
2934 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2936 If the requested operation results in an overflow or an underflow condition,
2937 then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2939 @param[in] Multiplicand A number that is to be multiplied by another
2940 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2941 @param[out] Result Pointer to the result of multiplication
2943 @retval RETURN_SUCCESS Successful multiplication
2944 @retval RETURN_BUFFER_TOO_SMALL Overflow
2945 @retval RETURN_INVALID_PARAMETER Result is NULL
2950 IN INT32 Multiplicand
,
2951 IN INT32 Multiplier
,
2958 Performs the requested operation using the input parameters into a value
2959 specified by Result type and stores the converted value into the caller
2960 allocated output buffer specified by Result. The caller must pass in a
2961 Result buffer that is at least as large as the Result type.
2963 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2965 If the requested operation results in an overflow or an underflow condition,
2966 then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2968 @param[in] Multiplicand A number that is to be multiplied by another
2969 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2970 @param[out] Result Pointer to the result of multiplication
2972 @retval RETURN_SUCCESS Successful multiplication
2973 @retval RETURN_BUFFER_TOO_SMALL Overflow
2974 @retval RETURN_INVALID_PARAMETER Result is NULL
2979 IN INTN Multiplicand
,
2985 INT64 multiplication
2987 Performs the requested operation using the input parameters into a value
2988 specified by Result type and stores the converted value into the caller
2989 allocated output buffer specified by Result. The caller must pass in a
2990 Result buffer that is at least as large as the Result type.
2992 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2994 If the requested operation results in an overflow or an underflow condition,
2995 then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2997 @param[in] Multiplicand A number that is to be multiplied by another
2998 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2999 @param[out] Result Pointer to the result of multiplication
3001 @retval RETURN_SUCCESS Successful multiplication
3002 @retval RETURN_BUFFER_TOO_SMALL Overflow
3003 @retval RETURN_INVALID_PARAMETER Result is NULL
3008 IN INT64 Multiplicand
,
3009 IN INT64 Multiplier
,
3013 #endif // __INT_SAFE_LIB_H__