From 2bd451b44547a38dd13669c47e239cfe2fdf325b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 7 Nov 2011 23:50:49 +1100 Subject: [PATCH] Log: make find_last_log_page() portable this makes it work with platforms with a larger 'long' --- ArduCopter/Log.pde | 4 ++-- ArduPlane/Log.pde | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ArduCopter/Log.pde b/ArduCopter/Log.pde index 9afccce08e8..5a2d34edd10 100644 --- a/ArduCopter/Log.pde +++ b/ArduCopter/Log.pde @@ -338,7 +338,7 @@ static int find_last_log_page(int bottom_page) { int top_page = 4096; int look_page; - long check; + int32_t check; while((top_page - bottom_page) > 1) { look_page = (top_page + bottom_page) / 2; @@ -347,7 +347,7 @@ static int find_last_log_page(int bottom_page) //Serial.printf("look page:%d, check:%d\n", look_page, check); - if(check == (long)0xFFFFFFFF) + if(check == (int32_t)~0) top_page = look_page; else bottom_page = look_page; diff --git a/ArduPlane/Log.pde b/ArduPlane/Log.pde index eaec54ac83d..90bb19b3ea9 100644 --- a/ArduPlane/Log.pde +++ b/ArduPlane/Log.pde @@ -313,13 +313,13 @@ static int find_last_log_page(int bottom_page) { int top_page = 4096; int look_page; - long check; + int32_t check; while((top_page - bottom_page) > 1) { look_page = (top_page + bottom_page) / 2; DataFlash.StartRead(look_page); check = DataFlash.ReadLong(); - if(check == (long)0xFFFFFFFF) + if(check == (int32_t)~0) top_page = look_page; else bottom_page = look_page;