C language > Expert questions

128-bit intrinsic math buggy?

<< < (2/2)

Pelle:
As explained in the help file ("Appendix" : "The inline assembler for X64"), mixing inline assembly and C code in the same function is a bad idea. When creating a whole function using inline assembly, it shouldn't be too hard moving this code to a separate file and use POASM. If problems, ask and someone in this forum will surely help you.

Akko:
The signed _mul128 intrinsic is buggy too. Perhaps the similar problem as with _udiv128 ...

Test code (ph should be 0):

// Intrinsic 128-bit multiplication test

#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <intrin.h>

int main(void) {
   int64_t ph=-7, pl=7;
   pl=_mul128((int64_t)-3,(int64_t)-3,&ph);
   printf("\npl=9?%d ph=0?%d",(int)pl,(int)ph);
   return 0;
}

Navigation

[0] Message Index

[*] Previous page

Go to full version