E8WATS

Fork of RemoteIR by Shinichiro Nakamura

Revision:
6:e57504fc802e
Parent:
5:e158c85c55ff
Child:
7:9452ba065449
--- a/ReceiverIR.cpp	Sat Aug 21 11:02:58 2010 +0000
+++ b/ReceiverIR.cpp	Sat Aug 21 11:04:54 2010 +0000
@@ -36,12 +36,12 @@
 int ReceiverIR::getData(RemoteIR::Format *format, uint8_t *buf, int bitlength) {
     IRQ_DISABLE();
 
-    const int nbytes = bitcount / 8 + (((bitcount % 8) != 0) ? 1 : 0);
     if (bitlength < data.bitcount) {
         IRQ_ENABLE();
         return -1;
     }
 
+    const int nbytes = data.bitcount / 8 + (((data.bitcount % 8) != 0) ? 1 : 0);
     *format = data.format;
     for (int i = 0; i < nbytes; i++) {
         buf[i] = data.buffer[i];