]>
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 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright notice,
13 this list of conditions and the following disclaimer in the documentation
14 and/or other materials provided with the distribution.
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
20 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
24 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #ifndef __INT_SAFE_LIB_H__
29 #define __INT_SAFE_LIB_H__
32 // It is common for -1 to be used as an error value
34 #define INT8_ERROR ((INT8) -1)
35 #define UINT8_ERROR MAX_UINT8
36 #define CHAR8_ERROR ((CHAR8)(MAX_INT8))
37 #define INT16_ERROR ((INT16) -1)
38 #define UINT16_ERROR MAX_UINT16
39 #define CHAR16_ERROR MAX_UINT16
40 #define INT32_ERROR ((INT32) -1)
41 #define UINT32_ERROR MAX_UINT32
42 #define INT64_ERROR ((INT64) -1)
43 #define UINT64_ERROR MAX_UINT64
44 #define INTN_ERROR ((INTN) -1)
45 #define UINTN_ERROR MAX_UINTN
48 // CHAR16 is defined to be the same as UINT16, so for CHAR16
49 // operations redirect to the UINT16 ones:
51 #define SafeInt8ToChar16 SafeInt8ToUint16
52 #define SafeInt16ToChar16 SafeInt16ToUint16
53 #define SafeInt32ToChar16 SafeInt32ToUint16
54 #define SafeUint32ToChar16 SafeUint32ToUint16
55 #define SafeInt64ToChar16 SafeInt64ToUint16
56 #define SafeUint64ToChar16 SafeUint64ToUint16
57 #define SafeIntnToChar16 SafeIntnToUint16
58 #define SafeUintnToChar16 SafeUintnToUint16
60 #define SafeChar16ToInt8 SafeUint16ToInt8
61 #define SafeChar16ToUint8 SafeUint16ToUint8
62 #define SafeChar16ToChar8 SafeUint16ToChar8
63 #define SafeChar16ToInt16 SafeUint16ToInt16
65 #define SafeChar16Mult SafeUint16Mult
66 #define SafeChar16Sub SafeUint16Sub
67 #define SafeChar16Add SafeUint16Add
70 // Conversion functions
72 // There are three reasons for having conversion functions:
74 // 1. We are converting from a signed type to an unsigned type of the same
75 // size, or vice-versa.
77 // 2. We are converting to a smaller type, and we could therefore possibly
80 // 3. We are converting to a bigger type, and we are signed and the type we are
81 // converting to is unsigned.
85 INT8 -> UINT8 conversion
87 Converts the value specified by Operand to a value specified by Result type
88 and stores the converted value into the caller allocated output buffer
89 specified by Result. The caller must pass in a Result buffer that is at
90 least as large as the Result type.
92 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
94 If the conversion results in an overflow or an underflow condition, then
95 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
97 @param[in] Operand Operand to be converted to new type
98 @param[out] Result Pointer to the result of conversion
100 @retval RETURN_SUCCESS Successful conversion
101 @retval RETURN_BUFFER_TOO_SMALL Overflow
102 @retval RETURN_INVALID_PARAMETER Result is NULL
112 INT8 -> CHAR8 conversion
114 Converts the value specified by Operand to a value specified by Result type
115 and stores the converted value into the caller allocated output buffer
116 specified by Result. The caller must pass in a Result buffer that is at
117 least as large as the Result type.
119 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
121 If the conversion results in an overflow or an underflow condition, then
122 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
124 @param[in] Operand Operand to be converted to new type
125 @param[out] Result Pointer to the result of conversion
127 @retval RETURN_SUCCESS Successful conversion
128 @retval RETURN_BUFFER_TOO_SMALL Overflow
129 @retval RETURN_INVALID_PARAMETER Result is NULL
139 INT8 -> UINT16 conversion
141 Converts the value specified by Operand to a value specified by Result type
142 and stores the converted value into the caller allocated output buffer
143 specified by Result. The caller must pass in a Result buffer that is at
144 least as large as the Result type.
146 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
148 If the conversion results in an overflow or an underflow condition, then
149 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
151 @param[in] Operand Operand to be converted to new type
152 @param[out] Result Pointer to the result of conversion
154 @retval RETURN_SUCCESS Successful conversion
155 @retval RETURN_BUFFER_TOO_SMALL Overflow
156 @retval RETURN_INVALID_PARAMETER Result is NULL
166 INT8 -> UINT32 conversion
168 Converts the value specified by Operand to a value specified by Result type
169 and stores the converted value into the caller allocated output buffer
170 specified by Result. The caller must pass in a Result buffer that is at
171 least as large as the Result type.
173 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
175 If the conversion results in an overflow or an underflow condition, then
176 Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
178 @param[in] Operand Operand to be converted to new type
179 @param[out] Result Pointer to the result of conversion
181 @retval RETURN_SUCCESS Successful conversion
182 @retval RETURN_BUFFER_TOO_SMALL Overflow
183 @retval RETURN_INVALID_PARAMETER Result is NULL
193 INT8 -> UINTN conversion
195 Converts the value specified by Operand to a value specified by Result type
196 and stores the converted value into the caller allocated output buffer
197 specified by Result. The caller must pass in a Result buffer that is at
198 least as large as the Result type.
200 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
202 If the conversion results in an overflow or an underflow condition, then
203 Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
205 @param[in] Operand Operand to be converted to new type
206 @param[out] Result Pointer to the result of conversion
208 @retval RETURN_SUCCESS Successful conversion
209 @retval RETURN_BUFFER_TOO_SMALL Overflow
210 @retval RETURN_INVALID_PARAMETER Result is NULL
220 INT8 -> UINT64 conversion
222 Converts the value specified by Operand to a value specified by Result type
223 and stores the converted value into the caller allocated output buffer
224 specified by Result. The caller must pass in a Result buffer that is at
225 least as large as the Result type.
227 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
229 If the conversion results in an overflow or an underflow condition, then
230 Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
232 @param[in] Operand Operand to be converted to new type
233 @param[out] Result Pointer to the result of conversion
235 @retval RETURN_SUCCESS Successful conversion
236 @retval RETURN_BUFFER_TOO_SMALL Overflow
237 @retval RETURN_INVALID_PARAMETER Result is NULL
247 UINT8 -> INT8 conversion
249 Converts the value specified by Operand to a value specified by Result type
250 and stores the converted value into the caller allocated output buffer
251 specified by Result. The caller must pass in a Result buffer that is at
252 least as large as the Result type.
254 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
256 If the conversion results in an overflow or an underflow condition, then
257 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
259 @param[in] Operand Operand to be converted to new type
260 @param[out] Result Pointer to the result of conversion
262 @retval RETURN_SUCCESS Successful conversion
263 @retval RETURN_BUFFER_TOO_SMALL Overflow
264 @retval RETURN_INVALID_PARAMETER Result is NULL
274 UINT8 -> CHAR8 conversion
276 Converts the value specified by Operand to a value specified by Result type
277 and stores the converted value into the caller allocated output buffer
278 specified by Result. The caller must pass in a Result buffer that is at
279 least as large as the Result type.
281 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
283 If the conversion results in an overflow or an underflow condition, then
284 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
286 @param[in] Operand Operand to be converted to new type
287 @param[out] Result Pointer to the result of conversion
289 @retval RETURN_SUCCESS Successful conversion
290 @retval RETURN_BUFFER_TOO_SMALL Overflow
291 @retval RETURN_INVALID_PARAMETER Result is NULL
301 INT16 -> INT8 conversion
303 Converts the value specified by Operand to a value specified by Result type
304 and stores the converted value into the caller allocated output buffer
305 specified by Result. The caller must pass in a Result buffer that is at
306 least as large as the Result type.
308 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
310 If the conversion results in an overflow or an underflow condition, then
311 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
313 @param[in] Operand Operand to be converted to new type
314 @param[out] Result Pointer to the result of conversion
316 @retval RETURN_SUCCESS Successful conversion
317 @retval RETURN_BUFFER_TOO_SMALL Overflow
318 @retval RETURN_INVALID_PARAMETER Result is NULL
328 INT16 -> CHAR8 conversion
330 Converts the value specified by Operand to a value specified by Result type
331 and stores the converted value into the caller allocated output buffer
332 specified by Result. The caller must pass in a Result buffer that is at
333 least as large as the Result type.
335 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
337 If the conversion results in an overflow or an underflow condition, then
338 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
340 @param[in] Operand Operand to be converted to new type
341 @param[out] Result Pointer to the result of conversion
343 @retval RETURN_SUCCESS Successful conversion
344 @retval RETURN_BUFFER_TOO_SMALL Overflow
345 @retval RETURN_INVALID_PARAMETER Result is NULL
355 INT16 -> UINT8 conversion
357 Converts the value specified by Operand to a value specified by Result type
358 and stores the converted value into the caller allocated output buffer
359 specified by Result. The caller must pass in a Result buffer that is at
360 least as large as the Result type.
362 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
364 If the conversion results in an overflow or an underflow condition, then
365 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
367 @param[in] Operand Operand to be converted to new type
368 @param[out] Result Pointer to the result of conversion
370 @retval RETURN_SUCCESS Successful conversion
371 @retval RETURN_BUFFER_TOO_SMALL Overflow
372 @retval RETURN_INVALID_PARAMETER Result is NULL
382 INT16 -> UINT16 conversion
384 Converts the value specified by Operand to a value specified by Result type
385 and stores the converted value into the caller allocated output buffer
386 specified by Result. The caller must pass in a Result buffer that is at
387 least as large as the Result type.
389 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
391 If the conversion results in an overflow or an underflow condition, then
392 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
394 @param[in] Operand Operand to be converted to new type
395 @param[out] Result Pointer to the result of conversion
397 @retval RETURN_SUCCESS Successful conversion
398 @retval RETURN_BUFFER_TOO_SMALL Overflow
399 @retval RETURN_INVALID_PARAMETER Result is NULL
409 INT16 -> UINT32 conversion
411 Converts the value specified by Operand to a value specified by Result type
412 and stores the converted value into the caller allocated output buffer
413 specified by Result. The caller must pass in a Result buffer that is at
414 least as large as the Result type.
416 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
418 If the conversion results in an overflow or an underflow condition, then
419 Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
421 @param[in] Operand Operand to be converted to new type
422 @param[out] Result Pointer to the result of conversion
424 @retval RETURN_SUCCESS Successful conversion
425 @retval RETURN_BUFFER_TOO_SMALL Overflow
426 @retval RETURN_INVALID_PARAMETER Result is NULL
436 INT16 -> UINTN conversion
438 Converts the value specified by Operand to a value specified by Result type
439 and stores the converted value into the caller allocated output buffer
440 specified by Result. The caller must pass in a Result buffer that is at
441 least as large as the Result type.
443 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
445 If the conversion results in an overflow or an underflow condition, then
446 Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
448 @param[in] Operand Operand to be converted to new type
449 @param[out] Result Pointer to the result of conversion
451 @retval RETURN_SUCCESS Successful conversion
452 @retval RETURN_BUFFER_TOO_SMALL Overflow
453 @retval RETURN_INVALID_PARAMETER Result is NULL
463 INT16 -> UINT64 conversion
465 Converts the value specified by Operand to a value specified by Result type
466 and stores the converted value into the caller allocated output buffer
467 specified by Result. The caller must pass in a Result buffer that is at
468 least as large as the Result type.
470 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
472 If the conversion results in an overflow or an underflow condition, then
473 Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
475 @param[in] Operand Operand to be converted to new type
476 @param[out] Result Pointer to the result of conversion
478 @retval RETURN_SUCCESS Successful conversion
479 @retval RETURN_BUFFER_TOO_SMALL Overflow
480 @retval RETURN_INVALID_PARAMETER Result is NULL
490 UINT16 -> INT8 conversion
492 Converts the value specified by Operand to a value specified by Result type
493 and stores the converted value into the caller allocated output buffer
494 specified by Result. The caller must pass in a Result buffer that is at
495 least as large as the Result type.
497 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
499 If the conversion results in an overflow or an underflow condition, then
500 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
502 @param[in] Operand Operand to be converted to new type
503 @param[out] Result Pointer to the result of conversion
505 @retval RETURN_SUCCESS Successful conversion
506 @retval RETURN_BUFFER_TOO_SMALL Overflow
507 @retval RETURN_INVALID_PARAMETER Result is NULL
517 UINT16 -> CHAR8 conversion
519 Converts the value specified by Operand to a value specified by Result type
520 and stores the converted value into the caller allocated output buffer
521 specified by Result. The caller must pass in a Result buffer that is at
522 least as large as the Result type.
524 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
526 If the conversion results in an overflow or an underflow condition, then
527 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
529 @param[in] Operand Operand to be converted to new type
530 @param[out] Result Pointer to the result of conversion
532 @retval RETURN_SUCCESS Successful conversion
533 @retval RETURN_BUFFER_TOO_SMALL Overflow
534 @retval RETURN_INVALID_PARAMETER Result is NULL
544 UINT16 -> UINT8 conversion
546 Converts the value specified by Operand to a value specified by Result type
547 and stores the converted value into the caller allocated output buffer
548 specified by Result. The caller must pass in a Result buffer that is at
549 least as large as the Result type.
551 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
553 If the conversion results in an overflow or an underflow condition, then
554 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
556 @param[in] Operand Operand to be converted to new type
557 @param[out] Result Pointer to the result of conversion
559 @retval RETURN_SUCCESS Successful conversion
560 @retval RETURN_BUFFER_TOO_SMALL Overflow
561 @retval RETURN_INVALID_PARAMETER Result is NULL
571 UINT16 -> INT16 conversion
573 Converts the value specified by Operand to a value specified by Result type
574 and stores the converted value into the caller allocated output buffer
575 specified by Result. The caller must pass in a Result buffer that is at
576 least as large as the Result type.
578 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
580 If the conversion results in an overflow or an underflow condition, then
581 Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
583 @param[in] Operand Operand to be converted to new type
584 @param[out] Result Pointer to the result of conversion
586 @retval RETURN_SUCCESS Successful conversion
587 @retval RETURN_BUFFER_TOO_SMALL Overflow
588 @retval RETURN_INVALID_PARAMETER Result is NULL
598 INT32 -> INT8 conversion
600 Converts the value specified by Operand to a value specified by Result type
601 and stores the converted value into the caller allocated output buffer
602 specified by Result. The caller must pass in a Result buffer that is at
603 least as large as the Result type.
605 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
607 If the conversion results in an overflow or an underflow condition, then
608 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
610 @param[in] Operand Operand to be converted to new type
611 @param[out] Result Pointer to the result of conversion
613 @retval RETURN_SUCCESS Successful conversion
614 @retval RETURN_BUFFER_TOO_SMALL Overflow
615 @retval RETURN_INVALID_PARAMETER Result is NULL
625 INT32 -> CHAR8 conversion
627 Converts the value specified by Operand to a value specified by Result type
628 and stores the converted value into the caller allocated output buffer
629 specified by Result. The caller must pass in a Result buffer that is at
630 least as large as the Result type.
632 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
634 If the conversion results in an overflow or an underflow condition, then
635 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
637 @param[in] Operand Operand to be converted to new type
638 @param[out] Result Pointer to the result of conversion
640 @retval RETURN_SUCCESS Successful conversion
641 @retval RETURN_BUFFER_TOO_SMALL Overflow
642 @retval RETURN_INVALID_PARAMETER Result is NULL
652 INT32 -> UINT8 conversion
654 Converts the value specified by Operand to a value specified by Result type
655 and stores the converted value into the caller allocated output buffer
656 specified by Result. The caller must pass in a Result buffer that is at
657 least as large as the Result type.
659 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
661 If the conversion results in an overflow or an underflow condition, then
662 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
664 @param[in] Operand Operand to be converted to new type
665 @param[out] Result Pointer to the result of conversion
667 @retval RETURN_SUCCESS Successful conversion
668 @retval RETURN_BUFFER_TOO_SMALL Overflow
669 @retval RETURN_INVALID_PARAMETER Result is NULL
679 INT32 -> INT16 conversion
681 Converts the value specified by Operand to a value specified by Result type
682 and stores the converted value into the caller allocated output buffer
683 specified by Result. The caller must pass in a Result buffer that is at
684 least as large as the Result type.
686 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
688 If the conversion results in an overflow or an underflow condition, then
689 Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
691 @param[in] Operand Operand to be converted to new type
692 @param[out] Result Pointer to the result of conversion
694 @retval RETURN_SUCCESS Successful conversion
695 @retval RETURN_BUFFER_TOO_SMALL Overflow
696 @retval RETURN_INVALID_PARAMETER Result is NULL
706 INT32 -> UINT16 conversion
708 Converts the value specified by Operand to a value specified by Result type
709 and stores the converted value into the caller allocated output buffer
710 specified by Result. The caller must pass in a Result buffer that is at
711 least as large as the Result type.
713 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
715 If the conversion results in an overflow or an underflow condition, then
716 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
718 @param[in] Operand Operand to be converted to new type
719 @param[out] Result Pointer to the result of conversion
721 @retval RETURN_SUCCESS Successful conversion
722 @retval RETURN_BUFFER_TOO_SMALL Overflow
723 @retval RETURN_INVALID_PARAMETER Result is NULL
734 INT32 -> UINT32 conversion
736 Converts the value specified by Operand to a value specified by Result type
737 and stores the converted value into the caller allocated output buffer
738 specified by Result. The caller must pass in a Result buffer that is at
739 least as large as the Result type.
741 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
743 If the conversion results in an overflow or an underflow condition, then
744 Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
746 @param[in] Operand Operand to be converted to new type
747 @param[out] Result Pointer to the result of conversion
749 @retval RETURN_SUCCESS Successful conversion
750 @retval RETURN_BUFFER_TOO_SMALL Overflow
751 @retval RETURN_INVALID_PARAMETER Result is NULL
761 INT32 -> UINTN conversion
763 Converts the value specified by Operand to a value specified by Result type
764 and stores the converted value into the caller allocated output buffer
765 specified by Result. The caller must pass in a Result buffer that is at
766 least as large as the Result type.
768 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
770 If the conversion results in an overflow or an underflow condition, then
771 Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
773 @param[in] Operand Operand to be converted to new type
774 @param[out] Result Pointer to the result of conversion
776 @retval RETURN_SUCCESS Successful conversion
777 @retval RETURN_BUFFER_TOO_SMALL Overflow
778 @retval RETURN_INVALID_PARAMETER Result is NULL
788 INT32 -> UINT64 conversion
790 Converts the value specified by Operand to a value specified by Result type
791 and stores the converted value into the caller allocated output buffer
792 specified by Result. The caller must pass in a Result buffer that is at
793 least as large as the Result type.
795 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
797 If the conversion results in an overflow or an underflow condition, then
798 Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
800 @param[in] Operand Operand to be converted to new type
801 @param[out] Result Pointer to the result of conversion
803 @retval RETURN_SUCCESS Successful conversion
804 @retval RETURN_BUFFER_TOO_SMALL Overflow
805 @retval RETURN_INVALID_PARAMETER Result is NULL
815 UINT32 -> INT8 conversion
817 Converts the value specified by Operand to a value specified by Result type
818 and stores the converted value into the caller allocated output buffer
819 specified by Result. The caller must pass in a Result buffer that is at
820 least as large as the Result type.
822 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
824 If the conversion results in an overflow or an underflow condition, then
825 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
827 @param[in] Operand Operand to be converted to new type
828 @param[out] Result Pointer to the result of conversion
830 @retval RETURN_SUCCESS Successful conversion
831 @retval RETURN_BUFFER_TOO_SMALL Overflow
832 @retval RETURN_INVALID_PARAMETER Result is NULL
842 UINT32 -> CHAR8 conversion
844 Converts the value specified by Operand to a value specified by Result type
845 and stores the converted value into the caller allocated output buffer
846 specified by Result. The caller must pass in a Result buffer that is at
847 least as large as the Result type.
849 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
851 If the conversion results in an overflow or an underflow condition, then
852 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
854 @param[in] Operand Operand to be converted to new type
855 @param[out] Result Pointer to the result of conversion
857 @retval RETURN_SUCCESS Successful conversion
858 @retval RETURN_BUFFER_TOO_SMALL Overflow
859 @retval RETURN_INVALID_PARAMETER Result is NULL
869 UINT32 -> UINT8 conversion
871 Converts the value specified by Operand to a value specified by Result type
872 and stores the converted value into the caller allocated output buffer
873 specified by Result. The caller must pass in a Result buffer that is at
874 least as large as the Result type.
876 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
878 If the conversion results in an overflow or an underflow condition, then
879 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
881 @param[in] Operand Operand to be converted to new type
882 @param[out] Result Pointer to the result of conversion
884 @retval RETURN_SUCCESS Successful conversion
885 @retval RETURN_BUFFER_TOO_SMALL Overflow
886 @retval RETURN_INVALID_PARAMETER Result is NULL
896 UINT32 -> INT16 conversion
898 Converts the value specified by Operand to a value specified by Result type
899 and stores the converted value into the caller allocated output buffer
900 specified by Result. The caller must pass in a Result buffer that is at
901 least as large as the Result type.
903 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
905 If the conversion results in an overflow or an underflow condition, then
906 Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
908 @param[in] Operand Operand to be converted to new type
909 @param[out] Result Pointer to the result of conversion
911 @retval RETURN_SUCCESS Successful conversion
912 @retval RETURN_BUFFER_TOO_SMALL Overflow
913 @retval RETURN_INVALID_PARAMETER Result is NULL
923 UINT32 -> UINT16 conversion
925 Converts the value specified by Operand to a value specified by Result type
926 and stores the converted value into the caller allocated output buffer
927 specified by Result. The caller must pass in a Result buffer that is at
928 least as large as the Result type.
930 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
932 If the conversion results in an overflow or an underflow condition, then
933 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
935 @param[in] Operand Operand to be converted to new type
936 @param[out] Result Pointer to the result of conversion
938 @retval RETURN_SUCCESS Successful conversion
939 @retval RETURN_BUFFER_TOO_SMALL Overflow
940 @retval RETURN_INVALID_PARAMETER Result is NULL
950 UINT32 -> INT32 conversion
952 Converts the value specified by Operand to a value specified by Result type
953 and stores the converted value into the caller allocated output buffer
954 specified by Result. The caller must pass in a Result buffer that is at
955 least as large as the Result type.
957 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
959 If the conversion results in an overflow or an underflow condition, then
960 Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
962 @param[in] Operand Operand to be converted to new type
963 @param[out] Result Pointer to the result of conversion
965 @retval RETURN_SUCCESS Successful conversion
966 @retval RETURN_BUFFER_TOO_SMALL Overflow
967 @retval RETURN_INVALID_PARAMETER Result is NULL
977 UINT32 -> INTN conversion
979 Converts the value specified by Operand to a value specified by Result type
980 and stores the converted value into the caller allocated output buffer
981 specified by Result. The caller must pass in a Result buffer that is at
982 least as large as the Result type.
984 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
986 If the conversion results in an overflow or an underflow condition, then
987 Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
989 @param[in] Operand Operand to be converted to new type
990 @param[out] Result Pointer to the result of conversion
992 @retval RETURN_SUCCESS Successful conversion
993 @retval RETURN_BUFFER_TOO_SMALL Overflow
994 @retval RETURN_INVALID_PARAMETER Result is NULL
1004 INTN -> INT8 conversion
1006 Converts the value specified by Operand to a value specified by Result type
1007 and stores the converted value into the caller allocated output buffer
1008 specified by Result. The caller must pass in a Result buffer that is at
1009 least as large as the Result type.
1011 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1013 If the conversion results in an overflow or an underflow condition, then
1014 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1016 @param[in] Operand Operand to be converted to new type
1017 @param[out] Result Pointer to the result of conversion
1019 @retval RETURN_SUCCESS Successful conversion
1020 @retval RETURN_BUFFER_TOO_SMALL Overflow
1021 @retval RETURN_INVALID_PARAMETER Result is NULL
1031 INTN -> CHAR8 conversion
1033 Converts the value specified by Operand to a value specified by Result type
1034 and stores the converted value into the caller allocated output buffer
1035 specified by Result. The caller must pass in a Result buffer that is at
1036 least as large as the Result type.
1038 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1040 If the conversion results in an overflow or an underflow condition, then
1041 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1043 @param[in] Operand Operand to be converted to new type
1044 @param[out] Result Pointer to the result of conversion
1046 @retval RETURN_SUCCESS Successful conversion
1047 @retval RETURN_BUFFER_TOO_SMALL Overflow
1048 @retval RETURN_INVALID_PARAMETER Result is NULL
1058 INTN -> UINT8 conversion
1060 Converts the value specified by Operand to a value specified by Result type
1061 and stores the converted value into the caller allocated output buffer
1062 specified by Result. The caller must pass in a Result buffer that is at
1063 least as large as the Result type.
1065 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1067 If the conversion results in an overflow or an underflow condition, then
1068 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1070 @param[in] Operand Operand to be converted to new type
1071 @param[out] Result Pointer to the result of conversion
1073 @retval RETURN_SUCCESS Successful conversion
1074 @retval RETURN_BUFFER_TOO_SMALL Overflow
1075 @retval RETURN_INVALID_PARAMETER Result is NULL
1085 INTN -> INT16 conversion
1087 Converts the value specified by Operand to a value specified by Result type
1088 and stores the converted value into the caller allocated output buffer
1089 specified by Result. The caller must pass in a Result buffer that is at
1090 least as large as the Result type.
1092 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1094 If the conversion results in an overflow or an underflow condition, then
1095 Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1097 @param[in] Operand Operand to be converted to new type
1098 @param[out] Result Pointer to the result of conversion
1100 @retval RETURN_SUCCESS Successful conversion
1101 @retval RETURN_BUFFER_TOO_SMALL Overflow
1102 @retval RETURN_INVALID_PARAMETER Result is NULL
1112 INTN -> UINT16 conversion
1114 Converts the value specified by Operand to a value specified by Result type
1115 and stores the converted value into the caller allocated output buffer
1116 specified by Result. The caller must pass in a Result buffer that is at
1117 least as large as the Result type.
1119 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1121 If the conversion results in an overflow or an underflow condition, then
1122 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1124 @param[in] Operand Operand to be converted to new type
1125 @param[out] Result Pointer to the result of conversion
1127 @retval RETURN_SUCCESS Successful conversion
1128 @retval RETURN_BUFFER_TOO_SMALL Overflow
1129 @retval RETURN_INVALID_PARAMETER Result is NULL
1139 INTN -> INT32 conversion
1141 Converts the value specified by Operand to a value specified by Result type
1142 and stores the converted value into the caller allocated output buffer
1143 specified by Result. The caller must pass in a Result buffer that is at
1144 least as large as the Result type.
1146 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1148 If the conversion results in an overflow or an underflow condition, then
1149 Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1151 @param[in] Operand Operand to be converted to new type
1152 @param[out] Result Pointer to the result of conversion
1154 @retval RETURN_SUCCESS Successful conversion
1155 @retval RETURN_BUFFER_TOO_SMALL Overflow
1156 @retval RETURN_INVALID_PARAMETER Result is NULL
1166 INTN -> UINT32 conversion
1168 Converts the value specified by Operand to a value specified by Result type
1169 and stores the converted value into the caller allocated output buffer
1170 specified by Result. The caller must pass in a Result buffer that is at
1171 least as large as the Result type.
1173 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1175 If the conversion results in an overflow or an underflow condition, then
1176 Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1178 @param[in] Operand Operand to be converted to new type
1179 @param[out] Result Pointer to the result of conversion
1181 @retval RETURN_SUCCESS Successful conversion
1182 @retval RETURN_BUFFER_TOO_SMALL Overflow
1183 @retval RETURN_INVALID_PARAMETER Result is NULL
1193 INTN -> UINTN conversion
1195 Converts the value specified by Operand to a value specified by Result type
1196 and stores the converted value into the caller allocated output buffer
1197 specified by Result. The caller must pass in a Result buffer that is at
1198 least as large as the Result type.
1200 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1202 If the conversion results in an overflow or an underflow condition, then
1203 Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1205 @param[in] Operand Operand to be converted to new type
1206 @param[out] Result Pointer to the result of conversion
1208 @retval RETURN_SUCCESS Successful conversion
1209 @retval RETURN_BUFFER_TOO_SMALL Overflow
1210 @retval RETURN_INVALID_PARAMETER Result is NULL
1220 INTN -> UINT64 conversion
1222 Converts the value specified by Operand to a value specified by Result type
1223 and stores the converted value into the caller allocated output buffer
1224 specified by Result. The caller must pass in a Result buffer that is at
1225 least as large as the Result type.
1227 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1229 If the conversion results in an overflow or an underflow condition, then
1230 Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1232 @param[in] Operand Operand to be converted to new type
1233 @param[out] Result Pointer to the result of conversion
1235 @retval RETURN_SUCCESS Successful conversion
1236 @retval RETURN_BUFFER_TOO_SMALL Overflow
1237 @retval RETURN_INVALID_PARAMETER Result is NULL
1247 UINTN -> INT8 conversion
1249 Converts the value specified by Operand to a value specified by Result type
1250 and stores the converted value into the caller allocated output buffer
1251 specified by Result. The caller must pass in a Result buffer that is at
1252 least as large as the Result type.
1254 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1256 If the conversion results in an overflow or an underflow condition, then
1257 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1259 @param[in] Operand Operand to be converted to new type
1260 @param[out] Result Pointer to the result of conversion
1262 @retval RETURN_SUCCESS Successful conversion
1263 @retval RETURN_BUFFER_TOO_SMALL Overflow
1264 @retval RETURN_INVALID_PARAMETER Result is NULL
1274 UINTN -> CHAR8 conversion
1276 Converts the value specified by Operand to a value specified by Result type
1277 and stores the converted value into the caller allocated output buffer
1278 specified by Result. The caller must pass in a Result buffer that is at
1279 least as large as the Result type.
1281 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1283 If the conversion results in an overflow or an underflow condition, then
1284 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1286 @param[in] Operand Operand to be converted to new type
1287 @param[out] Result Pointer to the result of conversion
1289 @retval RETURN_SUCCESS Successful conversion
1290 @retval RETURN_BUFFER_TOO_SMALL Overflow
1291 @retval RETURN_INVALID_PARAMETER Result is NULL
1301 UINTN -> UINT8 conversion
1303 Converts the value specified by Operand to a value specified by Result type
1304 and stores the converted value into the caller allocated output buffer
1305 specified by Result. The caller must pass in a Result buffer that is at
1306 least as large as the Result type.
1308 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1310 If the conversion results in an overflow or an underflow condition, then
1311 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1313 @param[in] Operand Operand to be converted to new type
1314 @param[out] Result Pointer to the result of conversion
1316 @retval RETURN_SUCCESS Successful conversion
1317 @retval RETURN_BUFFER_TOO_SMALL Overflow
1318 @retval RETURN_INVALID_PARAMETER Result is NULL
1328 UINTN -> INT16 conversion
1330 Converts the value specified by Operand to a value specified by Result type
1331 and stores the converted value into the caller allocated output buffer
1332 specified by Result. The caller must pass in a Result buffer that is at
1333 least as large as the Result type.
1335 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1337 If the conversion results in an overflow or an underflow condition, then
1338 Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1340 @param[in] Operand Operand to be converted to new type
1341 @param[out] Result Pointer to the result of conversion
1343 @retval RETURN_SUCCESS Successful conversion
1344 @retval RETURN_BUFFER_TOO_SMALL Overflow
1345 @retval RETURN_INVALID_PARAMETER Result is NULL
1355 UINTN -> UINT16 conversion
1357 Converts the value specified by Operand to a value specified by Result type
1358 and stores the converted value into the caller allocated output buffer
1359 specified by Result. The caller must pass in a Result buffer that is at
1360 least as large as the Result type.
1362 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1364 If the conversion results in an overflow or an underflow condition, then
1365 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1367 @param[in] Operand Operand to be converted to new type
1368 @param[out] Result Pointer to the result of conversion
1370 @retval RETURN_SUCCESS Successful conversion
1371 @retval RETURN_BUFFER_TOO_SMALL Overflow
1372 @retval RETURN_INVALID_PARAMETER Result is NULL
1382 UINTN -> INT32 conversion
1384 Converts the value specified by Operand to a value specified by Result type
1385 and stores the converted value into the caller allocated output buffer
1386 specified by Result. The caller must pass in a Result buffer that is at
1387 least as large as the Result type.
1389 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1391 If the conversion results in an overflow or an underflow condition, then
1392 Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1394 @param[in] Operand Operand to be converted to new type
1395 @param[out] Result Pointer to the result of conversion
1397 @retval RETURN_SUCCESS Successful conversion
1398 @retval RETURN_BUFFER_TOO_SMALL Overflow
1399 @retval RETURN_INVALID_PARAMETER Result is NULL
1409 UINTN -> UINT32 conversion
1411 Converts the value specified by Operand to a value specified by Result type
1412 and stores the converted value into the caller allocated output buffer
1413 specified by Result. The caller must pass in a Result buffer that is at
1414 least as large as the Result type.
1416 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1418 If the conversion results in an overflow or an underflow condition, then
1419 Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1421 @param[in] Operand Operand to be converted to new type
1422 @param[out] Result Pointer to the result of conversion
1424 @retval RETURN_SUCCESS Successful conversion
1425 @retval RETURN_BUFFER_TOO_SMALL Overflow
1426 @retval RETURN_INVALID_PARAMETER Result is NULL
1436 UINTN -> INTN conversion
1438 Converts the value specified by Operand to a value specified by Result type
1439 and stores the converted value into the caller allocated output buffer
1440 specified by Result. The caller must pass in a Result buffer that is at
1441 least as large as the Result type.
1443 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1445 If the conversion results in an overflow or an underflow condition, then
1446 Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1448 @param[in] Operand Operand to be converted to new type
1449 @param[out] Result Pointer to the result of conversion
1451 @retval RETURN_SUCCESS Successful conversion
1452 @retval RETURN_BUFFER_TOO_SMALL Overflow
1453 @retval RETURN_INVALID_PARAMETER Result is NULL
1463 UINTN -> INT64 conversion
1465 Converts the value specified by Operand to a value specified by Result type
1466 and stores the converted value into the caller allocated output buffer
1467 specified by Result. The caller must pass in a Result buffer that is at
1468 least as large as the Result type.
1470 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1472 If the conversion results in an overflow or an underflow condition, then
1473 Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1475 @param[in] Operand Operand to be converted to new type
1476 @param[out] Result Pointer to the result of conversion
1478 @retval RETURN_SUCCESS Successful conversion
1479 @retval RETURN_BUFFER_TOO_SMALL Overflow
1480 @retval RETURN_INVALID_PARAMETER Result is NULL
1490 INT64 -> INT8 conversion
1492 Converts the value specified by Operand to a value specified by Result type
1493 and stores the converted value into the caller allocated output buffer
1494 specified by Result. The caller must pass in a Result buffer that is at
1495 least as large as the Result type.
1497 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1499 If the conversion results in an overflow or an underflow condition, then
1500 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1502 @param[in] Operand Operand to be converted to new type
1503 @param[out] Result Pointer to the result of conversion
1505 @retval RETURN_SUCCESS Successful conversion
1506 @retval RETURN_BUFFER_TOO_SMALL Overflow
1507 @retval RETURN_INVALID_PARAMETER Result is NULL
1517 INT64 -> CHAR8 conversion
1519 Converts the value specified by Operand to a value specified by Result type
1520 and stores the converted value into the caller allocated output buffer
1521 specified by Result. The caller must pass in a Result buffer that is at
1522 least as large as the Result type.
1524 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1526 If the conversion results in an overflow or an underflow condition, then
1527 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1529 @param[in] Operand Operand to be converted to new type
1530 @param[out] Result Pointer to the result of conversion
1532 @retval RETURN_SUCCESS Successful conversion
1533 @retval RETURN_BUFFER_TOO_SMALL Overflow
1534 @retval RETURN_INVALID_PARAMETER Result is NULL
1544 INT64 -> UINT8 conversion
1546 Converts the value specified by Operand to a value specified by Result type
1547 and stores the converted value into the caller allocated output buffer
1548 specified by Result. The caller must pass in a Result buffer that is at
1549 least as large as the Result type.
1551 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1553 If the conversion results in an overflow or an underflow condition, then
1554 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1556 @param[in] Operand Operand to be converted to new type
1557 @param[out] Result Pointer to the result of conversion
1559 @retval RETURN_SUCCESS Successful conversion
1560 @retval RETURN_BUFFER_TOO_SMALL Overflow
1561 @retval RETURN_INVALID_PARAMETER Result is NULL
1571 INT64 -> INT16 conversion
1573 Converts the value specified by Operand to a value specified by Result type
1574 and stores the converted value into the caller allocated output buffer
1575 specified by Result. The caller must pass in a Result buffer that is at
1576 least as large as the Result type.
1578 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1580 If the conversion results in an overflow or an underflow condition, then
1581 Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1583 @param[in] Operand Operand to be converted to new type
1584 @param[out] Result Pointer to the result of conversion
1586 @retval RETURN_SUCCESS Successful conversion
1587 @retval RETURN_BUFFER_TOO_SMALL Overflow
1588 @retval RETURN_INVALID_PARAMETER Result is NULL
1598 INT64 -> UINT16 conversion
1600 Converts the value specified by Operand to a value specified by Result type
1601 and stores the converted value into the caller allocated output buffer
1602 specified by Result. The caller must pass in a Result buffer that is at
1603 least as large as the Result type.
1605 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1607 If the conversion results in an overflow or an underflow condition, then
1608 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1610 @param[in] Operand Operand to be converted to new type
1611 @param[out] Result Pointer to the result of conversion
1613 @retval RETURN_SUCCESS Successful conversion
1614 @retval RETURN_BUFFER_TOO_SMALL Overflow
1615 @retval RETURN_INVALID_PARAMETER Result is NULL
1625 INT64 -> INT32 conversion
1627 Converts the value specified by Operand to a value specified by Result type
1628 and stores the converted value into the caller allocated output buffer
1629 specified by Result. The caller must pass in a Result buffer that is at
1630 least as large as the Result type.
1632 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1634 If the conversion results in an overflow or an underflow condition, then
1635 Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1637 @param[in] Operand Operand to be converted to new type
1638 @param[out] Result Pointer to the result of conversion
1640 @retval RETURN_SUCCESS Successful conversion
1641 @retval RETURN_BUFFER_TOO_SMALL Overflow
1642 @retval RETURN_INVALID_PARAMETER Result is NULL
1652 INT64 -> UINT32 conversion
1654 Converts the value specified by Operand to a value specified by Result type
1655 and stores the converted value into the caller allocated output buffer
1656 specified by Result. The caller must pass in a Result buffer that is at
1657 least as large as the Result type.
1659 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1661 If the conversion results in an overflow or an underflow condition, then
1662 Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1664 @param[in] Operand Operand to be converted to new type
1665 @param[out] Result Pointer to the result of conversion
1667 @retval RETURN_SUCCESS Successful conversion
1668 @retval RETURN_BUFFER_TOO_SMALL Overflow
1669 @retval RETURN_INVALID_PARAMETER Result is NULL
1679 INT64 -> INTN conversion
1681 Converts the value specified by Operand to a value specified by Result type
1682 and stores the converted value into the caller allocated output buffer
1683 specified by Result. The caller must pass in a Result buffer that is at
1684 least as large as the Result type.
1686 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1688 If the conversion results in an overflow or an underflow condition, then
1689 Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1691 @param[in] Operand Operand to be converted to new type
1692 @param[out] Result Pointer to the result of conversion
1694 @retval RETURN_SUCCESS Successful conversion
1695 @retval RETURN_BUFFER_TOO_SMALL Overflow
1696 @retval RETURN_INVALID_PARAMETER Result is NULL
1706 INT64 -> UINTN conversion
1708 Converts the value specified by Operand to a value specified by Result type
1709 and stores the converted value into the caller allocated output buffer
1710 specified by Result. The caller must pass in a Result buffer that is at
1711 least as large as the Result type.
1713 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1715 If the conversion results in an overflow or an underflow condition, then
1716 Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1718 @param[in] Operand Operand to be converted to new type
1719 @param[out] Result Pointer to the result of conversion
1721 @retval RETURN_SUCCESS Successful conversion
1722 @retval RETURN_BUFFER_TOO_SMALL Overflow
1723 @retval RETURN_INVALID_PARAMETER Result is NULL
1733 INT64 -> UINT64 conversion
1735 Converts the value specified by Operand to a value specified by Result type
1736 and stores the converted value into the caller allocated output buffer
1737 specified by Result. The caller must pass in a Result buffer that is at
1738 least as large as the Result type.
1740 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1742 If the conversion results in an overflow or an underflow condition, then
1743 Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1745 @param[in] Operand Operand to be converted to new type
1746 @param[out] Result Pointer to the result of conversion
1748 @retval RETURN_SUCCESS Successful conversion
1749 @retval RETURN_BUFFER_TOO_SMALL Overflow
1750 @retval RETURN_INVALID_PARAMETER Result is NULL
1760 UINT64 -> INT8 conversion
1762 Converts the value specified by Operand to a value specified by Result type
1763 and stores the converted value into the caller allocated output buffer
1764 specified by Result. The caller must pass in a Result buffer that is at
1765 least as large as the Result type.
1767 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1769 If the conversion results in an overflow or an underflow condition, then
1770 Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1772 @param[in] Operand Operand to be converted to new type
1773 @param[out] Result Pointer to the result of conversion
1775 @retval RETURN_SUCCESS Successful conversion
1776 @retval RETURN_BUFFER_TOO_SMALL Overflow
1777 @retval RETURN_INVALID_PARAMETER Result is NULL
1787 UINT64 -> CHAR8 conversion
1789 Converts the value specified by Operand to a value specified by Result type
1790 and stores the converted value into the caller allocated output buffer
1791 specified by Result. The caller must pass in a Result buffer that is at
1792 least as large as the Result type.
1794 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1796 If the conversion results in an overflow or an underflow condition, then
1797 Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1799 @param[in] Operand Operand to be converted to new type
1800 @param[out] Result Pointer to the result of conversion
1802 @retval RETURN_SUCCESS Successful conversion
1803 @retval RETURN_BUFFER_TOO_SMALL Overflow
1804 @retval RETURN_INVALID_PARAMETER Result is NULL
1814 UINT64 -> UINT8 conversion
1816 Converts the value specified by Operand to a value specified by Result type
1817 and stores the converted value into the caller allocated output buffer
1818 specified by Result. The caller must pass in a Result buffer that is at
1819 least as large as the Result type.
1821 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1823 If the conversion results in an overflow or an underflow condition, then
1824 Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1826 @param[in] Operand Operand to be converted to new type
1827 @param[out] Result Pointer to the result of conversion
1829 @retval RETURN_SUCCESS Successful conversion
1830 @retval RETURN_BUFFER_TOO_SMALL Overflow
1831 @retval RETURN_INVALID_PARAMETER Result is NULL
1841 UINT64 -> INT16 conversion
1843 Converts the value specified by Operand to a value specified by Result type
1844 and stores the converted value into the caller allocated output buffer
1845 specified by Result. The caller must pass in a Result buffer that is at
1846 least as large as the Result type.
1848 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1850 If the conversion results in an overflow or an underflow condition, then
1851 Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1853 @param[in] Operand Operand to be converted to new type
1854 @param[out] Result Pointer to the result of conversion
1856 @retval RETURN_SUCCESS Successful conversion
1857 @retval RETURN_BUFFER_TOO_SMALL Overflow
1858 @retval RETURN_INVALID_PARAMETER Result is NULL
1868 UINT64 -> UINT16 conversion
1870 Converts the value specified by Operand to a value specified by Result type
1871 and stores the converted value into the caller allocated output buffer
1872 specified by Result. The caller must pass in a Result buffer that is at
1873 least as large as the Result type.
1875 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1877 If the conversion results in an overflow or an underflow condition, then
1878 Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1880 @param[in] Operand Operand to be converted to new type
1881 @param[out] Result Pointer to the result of conversion
1883 @retval RETURN_SUCCESS Successful conversion
1884 @retval RETURN_BUFFER_TOO_SMALL Overflow
1885 @retval RETURN_INVALID_PARAMETER Result is NULL
1889 SafeUint64ToUint16 (
1895 UINT64 -> INT32 conversion
1897 Converts the value specified by Operand to a value specified by Result type
1898 and stores the converted value into the caller allocated output buffer
1899 specified by Result. The caller must pass in a Result buffer that is at
1900 least as large as the Result type.
1902 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1904 If the conversion results in an overflow or an underflow condition, then
1905 Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1907 @param[in] Operand Operand to be converted to new type
1908 @param[out] Result Pointer to the result of conversion
1910 @retval RETURN_SUCCESS Successful conversion
1911 @retval RETURN_BUFFER_TOO_SMALL Overflow
1912 @retval RETURN_INVALID_PARAMETER Result is NULL
1922 UINT64 -> UINT32 conversion
1924 Converts the value specified by Operand to a value specified by Result type
1925 and stores the converted value into the caller allocated output buffer
1926 specified by Result. The caller must pass in a Result buffer that is at
1927 least as large as the Result type.
1929 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1931 If the conversion results in an overflow or an underflow condition, then
1932 Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1934 @param[in] Operand Operand to be converted to new type
1935 @param[out] Result Pointer to the result of conversion
1937 @retval RETURN_SUCCESS Successful conversion
1938 @retval RETURN_BUFFER_TOO_SMALL Overflow
1939 @retval RETURN_INVALID_PARAMETER Result is NULL
1943 SafeUint64ToUint32 (
1949 UINT64 -> INTN conversion
1951 Converts the value specified by Operand to a value specified by Result type
1952 and stores the converted value into the caller allocated output buffer
1953 specified by Result. The caller must pass in a Result buffer that is at
1954 least as large as the Result type.
1956 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1958 If the conversion results in an overflow or an underflow condition, then
1959 Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1961 @param[in] Operand Operand to be converted to new type
1962 @param[out] Result Pointer to the result of conversion
1964 @retval RETURN_SUCCESS Successful conversion
1965 @retval RETURN_BUFFER_TOO_SMALL Overflow
1966 @retval RETURN_INVALID_PARAMETER Result is NULL
1976 UINT64 -> UINTN conversion
1978 Converts the value specified by Operand to a value specified by Result type
1979 and stores the converted value into the caller allocated output buffer
1980 specified by Result. The caller must pass in a Result buffer that is at
1981 least as large as the Result type.
1983 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
1985 If the conversion results in an overflow or an underflow condition, then
1986 Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
1988 @param[in] Operand Operand to be converted to new type
1989 @param[out] Result Pointer to the result of conversion
1991 @retval RETURN_SUCCESS Successful conversion
1992 @retval RETURN_BUFFER_TOO_SMALL Overflow
1993 @retval RETURN_INVALID_PARAMETER Result is NULL
2003 UINT64 -> INT64 conversion
2005 Converts the value specified by Operand to a value specified by Result type
2006 and stores the converted value into the caller allocated output buffer
2007 specified by Result. The caller must pass in a Result buffer that is at
2008 least as large as the Result type.
2010 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2012 If the conversion results in an overflow or an underflow condition, then
2013 Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2015 @param[in] Operand Operand to be converted to new type
2016 @param[out] Result Pointer to the result of conversion
2018 @retval RETURN_SUCCESS Successful conversion
2019 @retval RETURN_BUFFER_TOO_SMALL Overflow
2020 @retval RETURN_INVALID_PARAMETER Result is NULL
2030 // Addition functions
2036 Performs the requested operation using the input parameters into a value
2037 specified by Result type and stores the converted value into the caller
2038 allocated output buffer specified by Result. The caller must pass in a
2039 Result buffer that is at least as large as the Result type.
2041 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2043 If the requested operation results in an overflow or an underflow condition,
2044 then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2046 @param[in] Augend A number to which addend will be added
2047 @param[in] Addend A number to be added to another
2048 @param[out] Result Pointer to the result of addition
2050 @retval RETURN_SUCCESS Successful addition
2051 @retval RETURN_BUFFER_TOO_SMALL Overflow
2052 @retval RETURN_INVALID_PARAMETER Result is NULL
2065 Performs the requested operation using the input parameters into a value
2066 specified by Result type and stores the converted value into the caller
2067 allocated output buffer specified by Result. The caller must pass in a
2068 Result buffer that is at least as large as the Result type.
2070 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2072 If the requested operation results in an overflow or an underflow condition,
2073 then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2075 @param[in] Augend A number to which addend will be added
2076 @param[in] Addend A number to be added to another
2077 @param[out] Result Pointer to the result of addition
2079 @retval RETURN_SUCCESS Successful addition
2080 @retval RETURN_BUFFER_TOO_SMALL Overflow
2081 @retval RETURN_INVALID_PARAMETER Result is NULL
2094 Performs the requested operation using the input parameters into a value
2095 specified by Result type and stores the converted value into the caller
2096 allocated output buffer specified by Result. The caller must pass in a
2097 Result buffer that is at least as large as the Result type.
2099 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2101 If the requested operation results in an overflow or an underflow condition,
2102 then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2104 @param[in] Augend A number to which addend will be added
2105 @param[in] Addend A number to be added to another
2106 @param[out] Result Pointer to the result of addition
2108 @retval RETURN_SUCCESS Successful addition
2109 @retval RETURN_BUFFER_TOO_SMALL Overflow
2110 @retval RETURN_INVALID_PARAMETER Result is NULL
2123 Performs the requested operation using the input parameters into a value
2124 specified by Result type and stores the converted value into the caller
2125 allocated output buffer specified by Result. The caller must pass in a
2126 Result buffer that is at least as large as the Result type.
2128 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2130 If the requested operation results in an overflow or an underflow condition,
2131 then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2133 @param[in] Augend A number to which addend will be added
2134 @param[in] Addend A number to be added to another
2135 @param[out] Result Pointer to the result of addition
2137 @retval RETURN_SUCCESS Successful addition
2138 @retval RETURN_BUFFER_TOO_SMALL Overflow
2139 @retval RETURN_INVALID_PARAMETER Result is NULL
2152 Performs the requested operation using the input parameters into a value
2153 specified by Result type and stores the converted value into the caller
2154 allocated output buffer specified by Result. The caller must pass in a
2155 Result buffer that is at least as large as the Result type.
2157 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2159 If the requested operation results in an overflow or an underflow condition,
2160 then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2162 @param[in] Augend A number to which addend will be added
2163 @param[in] Addend A number to be added to another
2164 @param[out] Result Pointer to the result of addition
2166 @retval RETURN_SUCCESS Successful addition
2167 @retval RETURN_BUFFER_TOO_SMALL Overflow
2168 @retval RETURN_INVALID_PARAMETER Result is NULL
2179 // Subtraction functions
2185 Performs the requested operation using the input parameters into a value
2186 specified by Result type and stores the converted value into the caller
2187 allocated output buffer specified by Result. The caller must pass in a
2188 Result buffer that is at least as large as the Result type.
2190 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2192 If the requested operation results in an overflow or an underflow condition,
2193 then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2195 @param[in] Minuend A number from which another is to be subtracted.
2196 @param[in] Subtrahend A number to be subtracted from another
2197 @param[out] Result Pointer to the result of subtraction
2199 @retval RETURN_SUCCESS Successful subtraction
2200 @retval RETURN_BUFFER_TOO_SMALL Underflow
2201 @retval RETURN_INVALID_PARAMETER Result is NULL
2207 IN UINT8 Subtrahend
,
2214 Performs the requested operation using the input parameters into a value
2215 specified by Result type and stores the converted value into the caller
2216 allocated output buffer specified by Result. The caller must pass in a
2217 Result buffer that is at least as large as the Result type.
2219 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2221 If the requested operation results in an overflow or an underflow condition,
2222 then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2224 @param[in] Minuend A number from which another is to be subtracted.
2225 @param[in] Subtrahend A number to be subtracted from another
2226 @param[out] Result Pointer to the result of subtraction
2228 @retval RETURN_SUCCESS Successful subtraction
2229 @retval RETURN_BUFFER_TOO_SMALL Underflow
2230 @retval RETURN_INVALID_PARAMETER Result is NULL
2236 IN UINT16 Subtrahend
,
2243 Performs the requested operation using the input parameters into a value
2244 specified by Result type and stores the converted value into the caller
2245 allocated output buffer specified by Result. The caller must pass in a
2246 Result buffer that is at least as large as the Result type.
2248 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2250 If the requested operation results in an overflow or an underflow condition,
2251 then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2253 @param[in] Minuend A number from which another is to be subtracted.
2254 @param[in] Subtrahend A number to be subtracted from another
2255 @param[out] Result Pointer to the result of subtraction
2257 @retval RETURN_SUCCESS Successful subtraction
2258 @retval RETURN_BUFFER_TOO_SMALL Underflow
2259 @retval RETURN_INVALID_PARAMETER Result is NULL
2265 IN UINT32 Subtrahend
,
2272 Performs the requested operation using the input parameters into a value
2273 specified by Result type and stores the converted value into the caller
2274 allocated output buffer specified by Result. The caller must pass in a
2275 Result buffer that is at least as large as the Result type.
2277 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2279 If the requested operation results in an overflow or an underflow condition,
2280 then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2282 @param[in] Minuend A number from which another is to be subtracted.
2283 @param[in] Subtrahend A number to be subtracted from another
2284 @param[out] Result Pointer to the result of subtraction
2286 @retval RETURN_SUCCESS Successful subtraction
2287 @retval RETURN_BUFFER_TOO_SMALL Underflow
2288 @retval RETURN_INVALID_PARAMETER Result is NULL
2294 IN UINTN Subtrahend
,
2301 Performs the requested operation using the input parameters into a value
2302 specified by Result type and stores the converted value into the caller
2303 allocated output buffer specified by Result. The caller must pass in a
2304 Result buffer that is at least as large as the Result type.
2306 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2308 If the requested operation results in an overflow or an underflow condition,
2309 then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2311 @param[in] Minuend A number from which another is to be subtracted.
2312 @param[in] Subtrahend A number to be subtracted from another
2313 @param[out] Result Pointer to the result of subtraction
2315 @retval RETURN_SUCCESS Successful subtraction
2316 @retval RETURN_BUFFER_TOO_SMALL Underflow
2317 @retval RETURN_INVALID_PARAMETER Result is NULL
2323 IN UINT64 Subtrahend
,
2328 // Multiplication functions
2332 UINT8 multiplication
2334 Performs the requested operation using the input parameters into a value
2335 specified by Result type and stores the converted value into the caller
2336 allocated output buffer specified by Result. The caller must pass in a
2337 Result buffer that is at least as large as the Result type.
2339 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2341 If the requested operation results in an overflow or an underflow condition,
2342 then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2344 @param[in] Multiplicand A number that is to be multiplied by another
2345 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2346 @param[out] Result Pointer to the result of multiplication
2348 @retval RETURN_SUCCESS Successful multiplication
2349 @retval RETURN_BUFFER_TOO_SMALL Overflow
2350 @retval RETURN_INVALID_PARAMETER Result is NULL
2355 IN UINT8 Multiplicand
,
2356 IN UINT8 Multiplier
,
2361 UINT16 multiplication
2363 Performs the requested operation using the input parameters into a value
2364 specified by Result type and stores the converted value into the caller
2365 allocated output buffer specified by Result. The caller must pass in a
2366 Result buffer that is at least as large as the Result type.
2368 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2370 If the requested operation results in an overflow or an underflow condition,
2371 then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2373 @param[in] Multiplicand A number that is to be multiplied by another
2374 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2375 @param[out] Result Pointer to the result of multiplication
2377 @retval RETURN_SUCCESS Successful multiplication
2378 @retval RETURN_BUFFER_TOO_SMALL Overflow
2379 @retval RETURN_INVALID_PARAMETER Result is NULL
2384 IN UINT16 Multiplicand
,
2385 IN UINT16 Multiplier
,
2390 UINT32 multiplication
2392 Performs the requested operation using the input parameters into a value
2393 specified by Result type and stores the converted value into the caller
2394 allocated output buffer specified by Result. The caller must pass in a
2395 Result buffer that is at least as large as the Result type.
2397 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2399 If the requested operation results in an overflow or an underflow condition,
2400 then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2402 @param[in] Multiplicand A number that is to be multiplied by another
2403 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2404 @param[out] Result Pointer to the result of multiplication
2406 @retval RETURN_SUCCESS Successful multiplication
2407 @retval RETURN_BUFFER_TOO_SMALL Overflow
2408 @retval RETURN_INVALID_PARAMETER Result is NULL
2413 IN UINT32 Multiplicand
,
2414 IN UINT32 Multiplier
,
2419 UINTN multiplication
2421 Performs the requested operation using the input parameters into a value
2422 specified by Result type and stores the converted value into the caller
2423 allocated output buffer specified by Result. The caller must pass in a
2424 Result buffer that is at least as large as the Result type.
2426 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2428 If the requested operation results in an overflow or an underflow condition,
2429 then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2431 @param[in] Multiplicand A number that is to be multiplied by another
2432 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2433 @param[out] Result Pointer to the result of multiplication
2435 @retval RETURN_SUCCESS Successful multiplication
2436 @retval RETURN_BUFFER_TOO_SMALL Overflow
2437 @retval RETURN_INVALID_PARAMETER Result is NULL
2442 IN UINTN Multiplicand
,
2443 IN UINTN Multiplier
,
2448 UINT64 multiplication
2450 Performs the requested operation using the input parameters into a value
2451 specified by Result type and stores the converted value into the caller
2452 allocated output buffer specified by Result. The caller must pass in a
2453 Result buffer that is at least as large as the Result type.
2455 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2457 If the requested operation results in an overflow or an underflow condition,
2458 then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2460 @param[in] Multiplicand A number that is to be multiplied by another
2461 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2462 @param[out] Result Pointer to the result of multiplication
2464 @retval RETURN_SUCCESS Successful multiplication
2465 @retval RETURN_BUFFER_TOO_SMALL Overflow
2466 @retval RETURN_INVALID_PARAMETER Result is NULL
2471 IN UINT64 Multiplicand
,
2472 IN UINT64 Multiplier
,
2477 // Signed operations
2479 // Strongly consider using unsigned numbers.
2481 // Signed numbers are often used where unsigned numbers should be used.
2482 // For example file sizes and array indices should always be unsigned.
2483 // Subtracting a larger positive signed number from a smaller positive
2484 // signed number with SafeInt32Sub will succeed, producing a negative number,
2485 // that then must not be used as an array index (but can occasionally be
2486 // used as a pointer index.) Similarly for adding a larger magnitude
2487 // negative number to a smaller magnitude positive number.
2489 // This library does not protect you from such errors. It tells you if your
2490 // integer operations overflowed, not if you are doing the right thing
2491 // with your non-overflowed integers.
2493 // Likewise you can overflow a buffer with a non-overflowed unsigned index.
2497 // Signed addition functions
2503 Performs the requested operation using the input parameters into a value
2504 specified by Result type and stores the converted value into the caller
2505 allocated output buffer specified by Result. The caller must pass in a
2506 Result buffer that is at least as large as the Result type.
2508 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2510 If the requested operation results in an overflow or an underflow condition,
2511 then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2513 @param[in] Augend A number to which addend will be added
2514 @param[in] Addend A number to be added to another
2515 @param[out] Result Pointer to the result of addition
2517 @retval RETURN_SUCCESS Successful addition
2518 @retval RETURN_BUFFER_TOO_SMALL Overflow
2519 @retval RETURN_INVALID_PARAMETER Result is NULL
2532 Performs the requested operation using the input parameters into a value
2533 specified by Result type and stores the converted value into the caller
2534 allocated output buffer specified by Result. The caller must pass in a
2535 Result buffer that is at least as large as the Result type.
2537 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2539 If the requested operation results in an overflow or an underflow condition,
2540 then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2542 @param[in] Augend A number to which addend will be added
2543 @param[in] Addend A number to be added to another
2544 @param[out] Result Pointer to the result of addition
2546 @retval RETURN_SUCCESS Successful addition
2547 @retval RETURN_BUFFER_TOO_SMALL Overflow
2548 @retval RETURN_INVALID_PARAMETER Result is NULL
2561 Performs the requested operation using the input parameters into a value
2562 specified by Result type and stores the converted value into the caller
2563 allocated output buffer specified by Result. The caller must pass in a
2564 Result buffer that is at least as large as the Result type.
2566 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2568 If the requested operation results in an overflow or an underflow condition,
2569 then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2571 @param[in] Augend A number to which addend will be added
2572 @param[in] Addend A number to be added to another
2573 @param[out] Result Pointer to the result of addition
2575 @retval RETURN_SUCCESS Successful addition
2576 @retval RETURN_BUFFER_TOO_SMALL Overflow
2577 @retval RETURN_INVALID_PARAMETER Result is NULL
2590 Performs the requested operation using the input parameters into a value
2591 specified by Result type and stores the converted value into the caller
2592 allocated output buffer specified by Result. The caller must pass in a
2593 Result buffer that is at least as large as the Result type.
2595 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2597 If the requested operation results in an overflow or an underflow condition,
2598 then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2600 @param[in] Augend A number to which addend will be added
2601 @param[in] Addend A number to be added to another
2602 @param[out] Result Pointer to the result of addition
2604 @retval RETURN_SUCCESS Successful addition
2605 @retval RETURN_BUFFER_TOO_SMALL Overflow
2606 @retval RETURN_INVALID_PARAMETER Result is NULL
2619 Performs the requested operation using the input parameters into a value
2620 specified by Result type and stores the converted value into the caller
2621 allocated output buffer specified by Result. The caller must pass in a
2622 Result buffer that is at least as large as the Result type.
2624 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2626 If the requested operation results in an overflow or an underflow condition,
2627 then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2629 @param[in] Augend A number to which addend will be added
2630 @param[in] Addend A number to be added to another
2631 @param[out] Result Pointer to the result of addition
2633 @retval RETURN_SUCCESS Successful addition
2634 @retval RETURN_BUFFER_TOO_SMALL Overflow
2635 @retval RETURN_INVALID_PARAMETER Result is NULL
2648 Performs the requested operation using the input parameters into a value
2649 specified by Result type and stores the converted value into the caller
2650 allocated output buffer specified by Result. The caller must pass in a
2651 Result buffer that is at least as large as the Result type.
2653 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2655 If the requested operation results in an overflow or an underflow condition,
2656 then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2658 @param[in] Augend A number to which addend will be added
2659 @param[in] Addend A number to be added to another
2660 @param[out] Result Pointer to the result of addition
2662 @retval RETURN_SUCCESS Successful addition
2663 @retval RETURN_BUFFER_TOO_SMALL Overflow
2664 @retval RETURN_INVALID_PARAMETER Result is NULL
2675 // Signed subtraction functions
2681 Performs the requested operation using the input parameters into a value
2682 specified by Result type and stores the converted value into the caller
2683 allocated output buffer specified by Result. The caller must pass in a
2684 Result buffer that is at least as large as the Result type.
2686 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2688 If the requested operation results in an overflow or an underflow condition,
2689 then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2691 @param[in] Minuend A number from which another is to be subtracted.
2692 @param[in] Subtrahend A number to be subtracted from another
2693 @param[out] Result Pointer to the result of subtraction
2695 @retval RETURN_SUCCESS Successful subtraction
2696 @retval RETURN_BUFFER_TOO_SMALL Underflow
2697 @retval RETURN_INVALID_PARAMETER Result is NULL
2710 Performs the requested operation using the input parameters into a value
2711 specified by Result type and stores the converted value into the caller
2712 allocated output buffer specified by Result. The caller must pass in a
2713 Result buffer that is at least as large as the Result type.
2715 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2717 If the requested operation results in an overflow or an underflow condition,
2718 then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2720 @param[in] Minuend A number from which another is to be subtracted.
2721 @param[in] Subtrahend A number to be subtracted from another
2722 @param[out] Result Pointer to the result of subtraction
2724 @retval RETURN_SUCCESS Successful subtraction
2725 @retval RETURN_BUFFER_TOO_SMALL Underflow
2726 @retval RETURN_INVALID_PARAMETER Result is NULL
2732 IN CHAR8 Subtrahend
,
2739 Performs the requested operation using the input parameters into a value
2740 specified by Result type and stores the converted value into the caller
2741 allocated output buffer specified by Result. The caller must pass in a
2742 Result buffer that is at least as large as the Result type.
2744 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2746 If the requested operation results in an overflow or an underflow condition,
2747 then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2749 @param[in] Minuend A number from which another is to be subtracted.
2750 @param[in] Subtrahend A number to be subtracted from another
2751 @param[out] Result Pointer to the result of subtraction
2753 @retval RETURN_SUCCESS Successful subtraction
2754 @retval RETURN_BUFFER_TOO_SMALL Underflow
2755 @retval RETURN_INVALID_PARAMETER Result is NULL
2761 IN INT16 Subtrahend
,
2768 Performs the requested operation using the input parameters into a value
2769 specified by Result type and stores the converted value into the caller
2770 allocated output buffer specified by Result. The caller must pass in a
2771 Result buffer that is at least as large as the Result type.
2773 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2775 If the requested operation results in an overflow or an underflow condition,
2776 then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2778 @param[in] Minuend A number from which another is to be subtracted.
2779 @param[in] Subtrahend A number to be subtracted from another
2780 @param[out] Result Pointer to the result of subtraction
2782 @retval RETURN_SUCCESS Successful subtraction
2783 @retval RETURN_BUFFER_TOO_SMALL Underflow
2784 @retval RETURN_INVALID_PARAMETER Result is NULL
2790 IN INT32 Subtrahend
,
2797 Performs the requested operation using the input parameters into a value
2798 specified by Result type and stores the converted value into the caller
2799 allocated output buffer specified by Result. The caller must pass in a
2800 Result buffer that is at least as large as the Result type.
2802 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2804 If the requested operation results in an overflow or an underflow condition,
2805 then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2807 @param[in] Minuend A number from which another is to be subtracted.
2808 @param[in] Subtrahend A number to be subtracted from another
2809 @param[out] Result Pointer to the result of subtraction
2811 @retval RETURN_SUCCESS Successful subtraction
2812 @retval RETURN_BUFFER_TOO_SMALL Underflow
2813 @retval RETURN_INVALID_PARAMETER Result is NULL
2826 Performs the requested operation using the input parameters into a value
2827 specified by Result type and stores the converted value into the caller
2828 allocated output buffer specified by Result. The caller must pass in a
2829 Result buffer that is at least as large as the Result type.
2831 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2833 If the requested operation results in an overflow or an underflow condition,
2834 then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2836 @param[in] Minuend A number from which another is to be subtracted.
2837 @param[in] Subtrahend A number to be subtracted from another
2838 @param[out] Result Pointer to the result of subtraction
2840 @retval RETURN_SUCCESS Successful subtraction
2841 @retval RETURN_BUFFER_TOO_SMALL Underflow
2842 @retval RETURN_INVALID_PARAMETER Result is NULL
2848 IN INT64 Subtrahend
,
2853 // Signed multiplication functions
2859 Performs the requested operation using the input parameters into a value
2860 specified by Result type and stores the converted value into the caller
2861 allocated output buffer specified by Result. The caller must pass in a
2862 Result buffer that is at least as large as the Result type.
2864 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2866 If the requested operation results in an overflow or an underflow condition,
2867 then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2869 @param[in] Multiplicand A number that is to be multiplied by another
2870 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2871 @param[out] Result Pointer to the result of multiplication
2873 @retval RETURN_SUCCESS Successful multiplication
2874 @retval RETURN_BUFFER_TOO_SMALL Overflow
2875 @retval RETURN_INVALID_PARAMETER Result is NULL
2880 IN INT8 Multiplicand
,
2886 CHAR8 multiplication
2888 Performs the requested operation using the input parameters into a value
2889 specified by Result type and stores the converted value into the caller
2890 allocated output buffer specified by Result. The caller must pass in a
2891 Result buffer that is at least as large as the Result type.
2893 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2895 If the requested operation results in an overflow or an underflow condition,
2896 then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2898 @param[in] Multiplicand A number that is to be multiplied by another
2899 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2900 @param[out] Result Pointer to the result of multiplication
2902 @retval RETURN_SUCCESS Successful multiplication
2903 @retval RETURN_BUFFER_TOO_SMALL Overflow
2904 @retval RETURN_INVALID_PARAMETER Result is NULL
2909 IN CHAR8 Multiplicand
,
2910 IN CHAR8 Multiplier
,
2915 INT16 multiplication
2917 Performs the requested operation using the input parameters into a value
2918 specified by Result type and stores the converted value into the caller
2919 allocated output buffer specified by Result. The caller must pass in a
2920 Result buffer that is at least as large as the Result type.
2922 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2924 If the requested operation results in an overflow or an underflow condition,
2925 then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2927 @param[in] Multiplicand A number that is to be multiplied by another
2928 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2929 @param[out] Result Pointer to the result of multiplication
2931 @retval RETURN_SUCCESS Successful multiplication
2932 @retval RETURN_BUFFER_TOO_SMALL Overflow
2933 @retval RETURN_INVALID_PARAMETER Result is NULL
2938 IN INT16 Multiplicand
,
2939 IN INT16 Multiplier
,
2944 INT32 multiplication
2946 Performs the requested operation using the input parameters into a value
2947 specified by Result type and stores the converted value into the caller
2948 allocated output buffer specified by Result. The caller must pass in a
2949 Result buffer that is at least as large as the Result type.
2951 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2953 If the requested operation results in an overflow or an underflow condition,
2954 then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2956 @param[in] Multiplicand A number that is to be multiplied by another
2957 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2958 @param[out] Result Pointer to the result of multiplication
2960 @retval RETURN_SUCCESS Successful multiplication
2961 @retval RETURN_BUFFER_TOO_SMALL Overflow
2962 @retval RETURN_INVALID_PARAMETER Result is NULL
2967 IN INT32 Multiplicand
,
2968 IN INT32 Multiplier
,
2975 Performs the requested operation using the input parameters into a value
2976 specified by Result type and stores the converted value into the caller
2977 allocated output buffer specified by Result. The caller must pass in a
2978 Result buffer that is at least as large as the Result type.
2980 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
2982 If the requested operation results in an overflow or an underflow condition,
2983 then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
2985 @param[in] Multiplicand A number that is to be multiplied by another
2986 @param[in] Multiplier A number by which the multiplicand is to be multiplied
2987 @param[out] Result Pointer to the result of multiplication
2989 @retval RETURN_SUCCESS Successful multiplication
2990 @retval RETURN_BUFFER_TOO_SMALL Overflow
2991 @retval RETURN_INVALID_PARAMETER Result is NULL
2996 IN INTN Multiplicand
,
3002 INT64 multiplication
3004 Performs the requested operation using the input parameters into a value
3005 specified by Result type and stores the converted value into the caller
3006 allocated output buffer specified by Result. The caller must pass in a
3007 Result buffer that is at least as large as the Result type.
3009 If Result is NULL, RETURN_INVALID_PARAMETER is returned.
3011 If the requested operation results in an overflow or an underflow condition,
3012 then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.
3014 @param[in] Multiplicand A number that is to be multiplied by another
3015 @param[in] Multiplier A number by which the multiplicand is to be multiplied
3016 @param[out] Result Pointer to the result of multiplication
3018 @retval RETURN_SUCCESS Successful multiplication
3019 @retval RETURN_BUFFER_TOO_SMALL Overflow
3020 @retval RETURN_INVALID_PARAMETER Result is NULL
3025 IN INT64 Multiplicand
,
3026 IN INT64 Multiplier
,
3030 #endif // __INT_SAFE_LIB_H__