Skip to content

Commit

Permalink
tlsf malloc: enable 64bit support on 64bit architectures
Browse files Browse the repository at this point in the history
On 64bit architectures TLSF_64BIT should be defined. Decide that
depending on the CONFIG_64BIT symbol. When 64bit support is enabled
all allocations will be aligned to 8 byte boundaries which is necessary
for architectures that do not support unaligned accesses or have
a performance penalty for unaligned accesses.
Also changes the undefined tlsf_decl to 'static'.

Signed-off-by: Sascha Hauer <[email protected]>
  • Loading branch information
saschahauer committed May 22, 2015
1 parent 4df73d5 commit e617c9b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion common/tlsfbits.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

#include <linux/bitops.h>

#ifdef CONFIG_64BIT
#define TLSF_64BIT
#endif

/*
** Architecture-specific bit manipulation routines.
**
Expand Down Expand Up @@ -33,7 +37,7 @@ static int tlsf_fls(unsigned int word)

/* Possibly 64-bit version of tlsf_fls. */
#if defined (TLSF_64BIT)
tlsf_decl int tlsf_fls_sizet(size_t size)
static int tlsf_fls_sizet(size_t size)
{
int high = (int)(size >> 32);
int bits = 0;
Expand Down

0 comments on commit e617c9b

Please sign in to comment.