TianoCore EDK2 master
Loading...
Searching...
No Matches
SafeIntLib64.c
Go to the documentation of this file.
1
12#include <Base.h>
13#include <Library/SafeIntLib.h>
14
35RETURN_STATUS
36EFIAPI
38 IN INT32 Operand,
39 OUT UINTN *Result
40 )
41{
42 return SafeInt32ToUint64 (Operand, (UINT64 *)Result);
43}
44
65RETURN_STATUS
66EFIAPI
68 IN UINT32 Operand,
69 OUT INTN *Result
70 )
71{
72 if (Result == NULL) {
74 }
75
76 *Result = Operand;
77 return RETURN_SUCCESS;
78}
79
100RETURN_STATUS
101EFIAPI
103 IN INTN Operand,
104 OUT INT32 *Result
105 )
106{
107 return SafeInt64ToInt32 ((INT64)Operand, Result);
108}
109
130RETURN_STATUS
131EFIAPI
133 IN INTN Operand,
134 OUT UINT32 *Result
135 )
136{
137 return SafeInt64ToUint32 ((INT64)Operand, Result);
138}
139
160RETURN_STATUS
161EFIAPI
163 IN UINTN Operand,
164 OUT UINT32 *Result
165 )
166{
167 return SafeUint64ToUint32 ((UINT64)Operand, Result);
168}
169
190RETURN_STATUS
191EFIAPI
193 IN UINTN Operand,
194 OUT INT64 *Result
195 )
196{
197 return SafeUint64ToInt64 ((UINT64)Operand, Result);
198}
199
220RETURN_STATUS
221EFIAPI
223 IN INT64 Operand,
224 OUT INTN *Result
225 )
226{
227 if (Result == NULL) {
229 }
230
231 *Result = (INTN)Operand;
232 return RETURN_SUCCESS;
233}
234
255RETURN_STATUS
256EFIAPI
258 IN INT64 Operand,
259 OUT UINTN *Result
260 )
261{
262 return SafeInt64ToUint64 (Operand, (UINT64 *)Result);
263}
264
285RETURN_STATUS
286EFIAPI
288 IN UINT64 Operand,
289 OUT UINTN *Result
290 )
291{
292 if (Result == NULL) {
294 }
295
296 *Result = Operand;
297 return RETURN_SUCCESS;
298}
299
321RETURN_STATUS
322EFIAPI
324 IN UINTN Augend,
325 IN UINTN Addend,
326 OUT UINTN *Result
327 )
328{
329 return SafeUint64Add ((UINT64)Augend, (UINT64)Addend, (UINT64 *)Result);
330}
331
353RETURN_STATUS
354EFIAPI
356 IN UINTN Minuend,
357 IN UINTN Subtrahend,
358 OUT UINTN *Result
359 )
360{
361 return SafeUint64Sub ((UINT64)Minuend, (UINT64)Subtrahend, (UINT64 *)Result);
362}
363
385RETURN_STATUS
386EFIAPI
388 IN UINTN Multiplicand,
389 IN UINTN Multiplier,
390 OUT UINTN *Result
391 )
392{
393 return SafeUint64Mult ((UINT64)Multiplicand, (UINT64)Multiplier, (UINT64 *)Result);
394}
395
417RETURN_STATUS
418EFIAPI
420 IN INTN Augend,
421 IN INTN Addend,
422 OUT INTN *Result
423 )
424{
425 return SafeInt64Add ((INT64)Augend, (INT64)Addend, (INT64 *)Result);
426}
427
449RETURN_STATUS
450EFIAPI
452 IN INTN Minuend,
453 IN INTN Subtrahend,
454 OUT INTN *Result
455 )
456{
457 return SafeInt64Sub ((INT64)Minuend, (INT64)Subtrahend, (INT64 *)Result);
458}
459
481RETURN_STATUS
482EFIAPI
484 IN INTN Multiplicand,
485 IN INTN Multiplier,
486 OUT INTN *Result
487 )
488{
489 return SafeInt64Mult ((INT64)Multiplicand, (INT64)Multiplier, (INT64 *)Result);
490}
UINT64 UINTN
INT64 INTN
#define NULL
Definition: Base.h:319
#define RETURN_SUCCESS
Definition: Base.h:1066
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define RETURN_INVALID_PARAMETER
Definition: Base.h:1076
RETURN_STATUS EFIAPI SafeInt64ToIntn(IN INT64 Operand, OUT INTN *Result)
Definition: SafeIntLib64.c:222
RETURN_STATUS EFIAPI SafeUint32ToIntn(IN UINT32 Operand, OUT INTN *Result)
Definition: SafeIntLib64.c:67
RETURN_STATUS EFIAPI SafeUintnAdd(IN UINTN Augend, IN UINTN Addend, OUT UINTN *Result)
Definition: SafeIntLib64.c:323
RETURN_STATUS EFIAPI SafeIntnToInt32(IN INTN Operand, OUT INT32 *Result)
Definition: SafeIntLib64.c:102
RETURN_STATUS EFIAPI SafeUintnMult(IN UINTN Multiplicand, IN UINTN Multiplier, OUT UINTN *Result)
Definition: SafeIntLib64.c:387
RETURN_STATUS EFIAPI SafeIntnToUint32(IN INTN Operand, OUT UINT32 *Result)
Definition: SafeIntLib64.c:132
RETURN_STATUS EFIAPI SafeUintnToUint32(IN UINTN Operand, OUT UINT32 *Result)
Definition: SafeIntLib64.c:162
RETURN_STATUS EFIAPI SafeIntnMult(IN INTN Multiplicand, IN INTN Multiplier, OUT INTN *Result)
Definition: SafeIntLib64.c:483
RETURN_STATUS EFIAPI SafeIntnSub(IN INTN Minuend, IN INTN Subtrahend, OUT INTN *Result)
Definition: SafeIntLib64.c:451
RETURN_STATUS EFIAPI SafeUintnToInt64(IN UINTN Operand, OUT INT64 *Result)
Definition: SafeIntLib64.c:192
RETURN_STATUS EFIAPI SafeInt32ToUintn(IN INT32 Operand, OUT UINTN *Result)
Definition: SafeIntLib64.c:37
RETURN_STATUS EFIAPI SafeIntnAdd(IN INTN Augend, IN INTN Addend, OUT INTN *Result)
Definition: SafeIntLib64.c:419
RETURN_STATUS EFIAPI SafeInt64ToUintn(IN INT64 Operand, OUT UINTN *Result)
Definition: SafeIntLib64.c:257
RETURN_STATUS EFIAPI SafeUint64ToUintn(IN UINT64 Operand, OUT UINTN *Result)
Definition: SafeIntLib64.c:287
RETURN_STATUS EFIAPI SafeUintnSub(IN UINTN Minuend, IN UINTN Subtrahend, OUT UINTN *Result)
Definition: SafeIntLib64.c:355
RETURN_STATUS EFIAPI SafeInt64ToInt32(IN INT64 Operand, OUT INT32 *Result)
Definition: SafeIntLib.c:2302
RETURN_STATUS EFIAPI SafeInt32ToUint64(IN INT32 Operand, OUT UINT64 *Result)
Definition: SafeIntLib.c:1158
RETURN_STATUS EFIAPI SafeInt64ToUint32(IN INT64 Operand, OUT UINT32 *Result)
Definition: SafeIntLib.c:2346
RETURN_STATUS EFIAPI SafeInt64Mult(IN INT64 Multiplicand, IN INT64 Multiplier, OUT INT64 *Result)
Definition: SafeIntLib.c:4094
RETURN_STATUS EFIAPI SafeUint64Sub(IN UINT64 Minuend, IN UINT64 Subtrahend, OUT UINT64 *Result)
Definition: SafeIntLib.c:3161
RETURN_STATUS EFIAPI SafeUint64Add(IN UINT64 Augend, IN UINT64 Addend, OUT UINT64 *Result)
Definition: SafeIntLib.c:2973
RETURN_STATUS EFIAPI SafeUint64Mult(IN UINT64 Multiplicand, IN UINT64 Multiplier, OUT UINT64 *Result)
Definition: SafeIntLib.c:3319
RETURN_STATUS EFIAPI SafeInt64Add(IN INT64 Augend, IN INT64 Addend, OUT INT64 *Result)
Definition: SafeIntLib.c:3613
RETURN_STATUS EFIAPI SafeInt64ToUint64(IN INT64 Operand, OUT UINT64 *Result)
Definition: SafeIntLib.c:2390
RETURN_STATUS EFIAPI SafeUint64ToInt64(IN UINT64 Operand, OUT INT64 *Result)
Definition: SafeIntLib.c:2786
RETURN_STATUS EFIAPI SafeUint64ToUint32(IN UINT64 Operand, OUT UINT32 *Result)
Definition: SafeIntLib.c:2698
RETURN_STATUS EFIAPI SafeInt64Sub(IN INT64 Minuend, IN INT64 Subtrahend, OUT INT64 *Result)
Definition: SafeIntLib.c:3857