avoid float -> int64 conversion #1977

cherry picking...
This commit is contained in:
rusefillc 2020-11-23 23:33:46 -05:00
parent be71d06dfc
commit 315bfe6531
4 changed files with 9 additions and 18 deletions

View File

@ -96,14 +96,4 @@ typedef unsigned int time_t;
#define CCM_OPTIONAL
#endif /* EFI_USE_CCM */
/**
* converts efitimeus_t to efitick_t
*/
#define US2NT(us) (((efitime_t)(us))*US_TO_NT_MULTIPLIER)
/**
* converts efitick_t to efitimeus_t
*/
#define NT2US(nt) ((nt) / US_TO_NT_MULTIPLIER)
#define UNIT_TEST_BUSY_WAIT_CALLBACK() {}

View File

@ -19,8 +19,17 @@
#define MS2US(MS_TIME) ((MS_TIME) * 1000)
// microseconds to ticks
#define US2NT(us) (((efitime_t)(us)) * US_TO_NT_MULTIPLIER)
#define USF2NT(us_float) ((us_float) * US_TO_NT_MULTIPLIER)
// And back
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
// milliseconds to ticks
#define MS2NT(msTime) US2NT(MS2US(msTime))
#define MSF2NT(msTimeFloat) USF2NT(MS2US(msTimeFloat))
/**
* We use this 'deep in past, before ECU has ever started' value as a way to unify

View File

@ -30,10 +30,6 @@
#define US_TO_NT_MULTIPLIER 100
#define US2NT(x) (US_TO_NT_MULTIPLIER * (x))
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
// need to fight 32bit int overflow
#define MY_US2ST(x) ((x) / 10)

View File

@ -58,10 +58,6 @@ void print(const char *fmt, ...);
#define VCS_VERSION "321"
#define RUS_EFI_VERSION_TAG "rusEfiVersion"
#define US2NT(x) (US_TO_NT_MULTIPLIER * (x))
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
#define INLINE inline
#define EFI_ERROR_CODE 0xffffffff