summaryrefslogtreecommitdiff
path: root/supervisor/memory.h
diff options
context:
space:
mode:
authorChristian Walther <cwalther@gmx.ch>2020-10-23 22:35:56 +0200
committerChristian Walther <cwalther@gmx.ch>2020-11-28 17:54:34 +0100
commit7ca36d45a4ffe40c70814d62cb970007b7f40fee (patch)
tree3ea89092ebe5a022670e4b53adfaf514d04155c6 /supervisor/memory.h
parenta4b84cf0e118f06cc3b563866d5c594b94b9b3fb (diff)
Fix align32_size().
It not only caused crashes with requests larger than 64K (can happen with RGBMatrix), but also generated a lot longer code than necessary.
Diffstat (limited to 'supervisor/memory.h')
-rwxr-xr-xsupervisor/memory.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/supervisor/memory.h b/supervisor/memory.h
index 4307e3f21..0f820eac1 100755
--- a/supervisor/memory.h
+++ b/supervisor/memory.h
@@ -64,11 +64,8 @@ supervisor_allocation* allocate_remaining_memory(void);
// supervisor_move_memory().
supervisor_allocation* allocate_memory(uint32_t length, bool high_address, bool movable);
-static inline uint16_t align32_size(uint16_t size) {
- if (size % 4 != 0) {
- return (size & 0xfffc) + 0x4;
- }
- return size;
+static inline size_t align32_size(size_t size) {
+ return (size + 3) & ~3;
}
size_t get_allocation_length(supervisor_allocation* allocation);