Skip to content
Snippets Groups Projects
Commit e08548a3 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

labcomm2014_decode_one now sets the LABCOMM2014_IS_SAMPLE (highest

non-sign bit) when a sample is returned.
parent b7a02c78
Branches
No related tags found
No related merge requests found
...@@ -30,11 +30,15 @@ ...@@ -30,11 +30,15 @@
#else #else
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h>
#endif #endif
#include "labcomm2014_error.h" #include "labcomm2014_error.h"
#include "labcomm2014_scheduler.h" #include "labcomm2014_scheduler.h"
/* Bits set in result of labcomm_decode_one */
#define LABCOMM2014_IS_SAMPLE (INT_MAX - (INT_MAX>>1))
/* Forward declaration */ /* Forward declaration */
struct labcomm2014_encoder; struct labcomm2014_encoder;
struct labcomm2014_decoder; struct labcomm2014_decoder;
......
...@@ -387,7 +387,7 @@ static int do_decode_one(struct labcomm2014_decoder *d) ...@@ -387,7 +387,7 @@ static int do_decode_one(struct labcomm2014_decoder *d)
DECODER_DEBUG_FPRINTF(stderr, "SKIP %d %d\n", remote_index, length); DECODER_DEBUG_FPRINTF(stderr, "SKIP %d %d\n", remote_index, length);
result = decoder_skip(d, length, remote_index); result = decoder_skip(d, length, remote_index);
} else { } else {
result = decode_and_handle(d, d, remote_index); result = decode_and_handle(d, d, remote_index) | LABCOMM2014_IS_SAMPLE;
} }
out: out:
return result; return result;
......
...@@ -229,6 +229,11 @@ static void test_encode_decode(struct labcomm2014_encoder *encoder, ...@@ -229,6 +229,11 @@ static void test_encode_decode(struct labcomm2014_encoder *encoder,
writer.pos, expected); writer.pos, expected);
exit(1); exit(1);
} }
if ((err & LABCOMM2014_IS_SAMPLE) == 0) {
fprintf(stderr, "Expected %x set in %x\n",
LABCOMM2014_IS_SAMPLE, err);
exit(1);
}
} }
static int do_test(int argc, char *argv[]) static int do_test(int argc, char *argv[])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment