Explorar el Código

core: qm/fm memory align size can be set with define KSR_MEMORY_ALIGN

- flexibility to be set at compile time via make or compiler parameter
Daniel-Constantin Mierla hace 1 año
padre
commit
80d1f10507
Se han modificado 2 ficheros con 11 adiciones y 2 borrados
  1. 6 1
      src/core/mem/f_malloc.h
  2. 5 1
      src/core/mem/q_malloc.h

+ 6 - 1
src/core/mem/f_malloc.h

@@ -46,10 +46,15 @@
  * can be 32 bits aligned => malloc should return multiple of long long
  * aligned memory
  * - malloc() on gnu/linux: multiple of 8 or 16 on 64-bit systems
- * - for simplicity settle for 16 always
+ * - for simplicity settle for 16 by default
  * - sizeof(fm_frag) must be multiple of ROUNDTO!
  */
+#ifndef KSR_MEMORY_ALIGN
 #define ROUNDTO 16UL
+#else
+#define ROUNDTO KSR_MEMORY_ALIGN
+#endif
+
 
 #define MIN_FRAG_SIZE ROUNDTO
 

+ 5 - 1
src/core/mem/q_malloc.h

@@ -39,10 +39,14 @@
  * can be 32 bits aligned => malloc should return multiple of long long
  * aligned memory
  * - malloc() on gnu/linux: multiple of 8 or 16 on 64-bit systems
- * - for simplicity settle for 16 always
+ * - for simplicity settle for 16 by default
  * - sizeof(qm_frag) and sizeof(qm_frag_end) must be multiple of ROUNDTO!
  */
+#ifndef KSR_MEMORY_ALIGN
 #define ROUNDTO 16UL
+#else
+#define ROUNDTO KSR_MEMORY_ALIGN
+#endif
 
 #define MIN_FRAG_SIZE ROUNDTO