The following code works in MSVC (64-bit) but I cannot make it run in PC12 (64-bit console):
// Intrinsic 128-bit multiplication/division test
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <intrin.h>
int main(void) {
uint64_t upl,uph,uq,ur=7;
upl=_umul128(-1,2,&uph);
printf("\nuph=1?%d upl=-2?%d",(int)uph,(int)upl);
uq=_udiv128(uph,upl,2,&ur);
printf("\nuq=-1?%d ur=0?%d",(int)uq,(int)ur);
return 0;
}
I tried /Ze compiler flags et cetera, but PC12 always struggles with the division :-(
Multiplication is no issue.