div64_s64() in asm/div64.h
Jump to turn (11)
- 1div64s64() in asm/div64.h
- 2implement div64s64() in freertos, it should do the same job as div64s64() functi
- 3are you sure about your implementation?
- 4update your implementation, it should includes for (int i = 63; i >= 0; i--) { r
- 5update your implementation it should includes dividend = dividend < 0 ? -dividen
- 6update your implementation by introducing a local variable sign
- 7update your implementation by introducing a local variable sign and should inclu
- 8update your implementation by initializing sign to be 1
- 9i am satisfied about this version of implementation, but are you 100% sure about
- 10now implement divs64() in freertos, it should do the same job as divs64() functi
- 11no, i need similar implementation like you implement div64s64
- User
div64_s64() in asm/div64.h
- Assistant
The div64_s64() function in asm/div64.h is a macro for performing signed division of two 64-bit integers. It takes two parameters, which are the dividend (64-bit signed integer) and the divisor (32-bit signed integer). The function returns the quotient of the division operation.
Here is the code for div64_s64():
cstatic inline int64_t div64_s64(int64_t dividend, int32_t divisor) { int64_t quotient; int32_t remainder; __asm__ ("idivl %4" : "=a" (quotient), "=d" (remainder) : "0" (dividend), "1" (0), "r" (divisor)); return quotient; }