You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/01/12 19:12:19 UTC

[GitHub] turon closed pull request #2: Revert incomplete 64-bit mempool support.

turon closed pull request #2: Revert incomplete 64-bit mempool support.
URL: https://github.com/apache/mynewt-nimble/pull/2
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/porting/common/src/os/os_mempool.c b/porting/common/src/os/os_mempool.c
index 55a8f123..65e4f615 100644
--- a/porting/common/src/os/os_mempool.c
+++ b/porting/common/src/os/os_mempool.c
@@ -102,7 +102,7 @@ os_mempool_init(struct os_mempool *mp, int blocks, int block_size,
         /* Blocks need to be sized properly and memory buffer should be
          * aligned
          */
-        if (((uintptr_t)membuf & (OS_ALIGNMENT - 1)) != 0) {
+        if (((uint32_t)membuf & (OS_ALIGNMENT - 1)) != 0) {
             return OS_MEM_NOT_ALIGNED;
         }
     }
@@ -113,7 +113,7 @@ os_mempool_init(struct os_mempool *mp, int blocks, int block_size,
     mp->mp_num_free = blocks;
     mp->mp_min_free = blocks;
     mp->mp_num_blocks = blocks;
-    mp->mp_membuf_addr = (uintptr_t)membuf;
+    mp->mp_membuf_addr = (uint32_t)membuf;
     mp->name = name;
     os_mempool_poison(membuf, true_block_size);
     SLIST_FIRST(mp) = membuf;
@@ -175,24 +175,24 @@ os_mempool_is_sane(const struct os_mempool *mp)
 int
 os_memblock_from(const struct os_mempool *mp, const void *block_addr)
 {
-    uint32_t  true_block_size;
-    uintptr_t baddr_ptr;
-    uint32_t  end;
+    uint32_t true_block_size;
+    uint32_t baddr32;
+    uint32_t end;
 
-    _Static_assert(sizeof block_addr == sizeof baddr_ptr,
+    _Static_assert(sizeof block_addr == sizeof baddr32,
                    "Pointer to void must be 32-bits.");
 
-    baddr_ptr = (uintptr_t)block_addr;
+    baddr32 = (uint32_t)block_addr;
     true_block_size = OS_MEMPOOL_TRUE_BLOCK_SIZE(mp);
     end = mp->mp_membuf_addr + (mp->mp_num_blocks * true_block_size);
 
     /* Check that the block is in the memory buffer range. */
-    if ((baddr_ptr < mp->mp_membuf_addr) || (baddr_ptr >= end)) {
+    if ((baddr32 < mp->mp_membuf_addr) || (baddr32 >= end)) {
         return 0;
     }
 
     /* All freed blocks should be on true block size boundaries! */
-    if (((baddr_ptr - mp->mp_membuf_addr) % true_block_size) != 0) {
+    if (((baddr32 - mp->mp_membuf_addr) % true_block_size) != 0) {
         return 0;
     }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services