[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] [patch #6418] Yet another delay routines
From: |
Timothy Baldwin |
Subject: |
[avr-libc-dev] [patch #6418] Yet another delay routines |
Date: |
Sun, 11 Oct 2009 14:31:32 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 |
Follow-up Comment #3, patch #6418 (project avr-libc):
Rather than generating an error when an integer non-constant is passed the
non-exact macros could form a loop around a constant delay.
#define _delay_ms(__ms)
do {
if (!__builtin_constant_p(F_CPU)) {
_DELAY_EMIT_ERROR(__STRINGIFY(F_CPU)
" is not a constant for _delay_ms");
} else if (__builtin_constant_p(__ms)) {
_delay_f_ms(F_CPU, __ms);
} else if ((__typeof__((_ms) + 0))0.25 == 0) {
__typeof__((__ms) + 0) __ms2 = __ms;
while (__ms2--) _delay_f_ms(F_CPU, 1);
} else {
_DELAY_EMIT_ERROR(__STRINGIFY(__ms)
" is not a constant or integer for _delay_ms");
}
} while (0)
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/patch/?6418>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [avr-libc-dev] [patch #6418] Yet another delay routines,
Timothy Baldwin <=