1 #ifndef __OVERUNDERFLOWCHECK__
2 #define __OVERUNDERFLOWCHECK__
4 inline uint32
CheckUInt32Add(uint32 a
, uint32 b
)
9 CssmError::throwMe(CSSMERR_DL_DATABASE_CORRUPT
);
17 inline uint32
CheckUInt32Subtract(uint32 a
, uint32 b
)
21 CssmError::throwMe(CSSMERR_DL_DATABASE_CORRUPT
);
29 inline uint32
CheckUInt32Multiply(uint32 a
, uint32 b
)
32 uint64 cc
= ((uint64
) a
) * ((uint64
) b
);
35 CssmError::throwMe(CSSMERR_DL_DATABASE_CORRUPT
);
43 inline uint64
Check64BitAdd(uint64 a
, uint64 b
)
48 CssmError::throwMe(CSSMERR_DL_DATABASE_CORRUPT
);
56 inline uint64
Check64BitSubtract(uint64 a
, uint64 b
)
60 CssmError::throwMe(CSSMERR_DL_DATABASE_CORRUPT
);
68 inline uint64
Check64BitMultiply(uint64 a
, uint64 b
)
72 uint64 max
= (uint64
) -1;
73 uint64 limit
= max
/ a
;
76 CssmError::throwMe(CSSMERR_DL_DATABASE_CORRUPT
);