summaryrefslogtreecommitdiff
path: root/cesar/lib
diff options
context:
space:
mode:
authorlaranjeiro2009-11-05 10:39:40 +0000
committerlaranjeiro2009-11-05 10:39:40 +0000
commitd34b0f8d6bd4b5890dc4a1efda9bfedfbd1348f9 (patch)
tree905e2e82d70309ac885ed0c5eb790b3379ded58b /cesar/lib
parent92be3469d06bd0d97f8bbf35bd995f36f0fb3221 (diff)
cesar/lib: fix sar_mf access when header is on 2 PBs, closes #748.
* read_word was returning a wrong value when requesting less than 4 bytes. * sar_mf was not able to read a header when 5 bytes of it was in the first PB and the last bytes was in the next one. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@6330 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/lib')
-rw-r--r--cesar/lib/read_word.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/cesar/lib/read_word.h b/cesar/lib/read_word.h
index ef88b27e15..1536f0fa0a 100644
--- a/cesar/lib/read_word.h
+++ b/cesar/lib/read_word.h
@@ -33,7 +33,8 @@
* Example : if you only need the two first bytes you should request:
* read_bytes_from_word (addr, 2) & 0xFFFF
*/
-extern inline uint read_bytes_from_word (u8 *addr, uint bytes)
+extern inline uint
+read_bytes_from_word (u8 *addr, uint bytes)
{
u8* addr_new;
uint rest;
@@ -64,7 +65,7 @@ extern inline uint read_bytes_from_word (u8 *addr, uint bytes)
result = word2 << (4 - rest) * 8 | word1;
}
- return result;
+ return (result & BITS_ONES (bytes * 8));
}
/**