CPUInfo: example fix travis warning

missing function declaration
implicit cast
some style fix
This commit is contained in:
Pierre Kancir 2017-04-13 13:34:26 +02:00 committed by Francisco Ferreira
parent eb4298ca3e
commit c73584c9b8

View File

@ -8,6 +8,9 @@
#include <AP_HAL/AP_HAL.h>
#include <AP_Common/AP_Common.h>
void setup();
void loop();
const AP_HAL::HAL& hal = AP_HAL::get_HAL();
void setup() {
@ -24,9 +27,9 @@ static void show_sizes(void)
hal.console->printf("bool : %lu\n", (unsigned long)sizeof(bool));
hal.console->printf("void* : %lu\n", (unsigned long)sizeof(void *));
hal.console->printf("printing NaN: %f\n", sqrt(-1.0f));
hal.console->printf("printing +Inf: %f\n", 1.0f/0.0f);
hal.console->printf("printing -Inf: %f\n", -1.0f/0.0f);
hal.console->printf("printing NaN: %f\n", (double)sqrtf(-1.0f));
hal.console->printf("printing +Inf: %f\n", (double)(1.0f/0.0f));
hal.console->printf("printing -Inf: %f\n", (double)(-1.0f/0.0f));
}
#define TENTIMES(x) do { x; x; x; x; x; x; x; x; x; x; } while (0)
@ -35,11 +38,11 @@ static void show_sizes(void)
#define TIMEIT(name, op, count) do { \
uint32_t us_end, us_start; \
us_start = AP_HAL::micros(); \
for (uint8_t i=0; i<count; i++) { \
for (uint8_t i = 0; i < count; i++) { \
FIFTYTIMES(op); \
} \
us_end = AP_HAL::micros(); \
hal.console->printf("%-10s %7.2f usec/call\n", name, double(us_end-us_start)/(count*50.0)); \
hal.console->printf("%-10s %7.2f usec/call\n", name, double(us_end - us_start) / (count * 50.0)); \
} while (0)
volatile float v_f = 1.0;