Znalazłem segment kodu. Nie rozumiem tego. Wydaje się, że zmienna __rem jest w ogóle bezużyteczna. Linia poniżej nie robi żadnej użytecznej pracy jeszcze:Co ten kod oznacza
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
Segment kodu całość jest jak poniżej:
#define do_div(n,base) do{ \
uint32_t __base = (base); \
uint32_t __rem; \
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
if (((n) >> 32) == 0) { \
__rem = (uint32_t)(n) % __base; \
(n) = (uint32_t)(n)/__base; \
} else \
__rem = __div64_32(&(n), __base); \
__rem; \
}while(0)
/* Wrapper for do_div(). Doesn't modify dividend and returns
* the result, not reminder.
*/
static inline uint64_t lldiv(uint64_t dividend, uint32_t divisor)
{
uint64_t __res = dividend;
do_div(__res, divisor);
return(__res);
}
Dlaczego jest bezużyteczny kod tutaj?
sprawdzanie poprawności kompilatora? – EOF
Ponownie, proszę podać informacje o toolchain. Jest to oczywiście nieodłączny kompilator (podwójny undersores w identyfikatorach). – Quentin
Jest to plik div64.h w systemie uboot. Kopiuję to i na początku działa dobrze. Ale kiedy skompilowałem go z RVDS 5.01. Kompilator narzekał, że "wyrażenie nie ma żadnego efektu"[email protected] – user1651758