pkarashchenko commented on code in PR #7285:
URL: https://github.com/apache/incubator-nuttx/pull/7285#discussion_r994777994


##########
mm/ubsan/ubsan.c:
##########
@@ -158,9 +158,11 @@ static int64_t get_signed_val(FAR struct type_descriptor 
*type,
   if (is_inline_int(type))
     {
       unsigned extra_bits = sizeof(int64_t) * 8 - type_bit_width(type);
-      uintptr_t ulong_val = (uintptr_t)val;
+      uint64_t mask = (1llu << extra_bits) - 1;
+      uint64_t ret = (uint64_t)val & mask;
 
-      return ((int64_t)ulong_val) << extra_bits >> extra_bits;
+      return (int64_t)(((ret & (1llu << (extra_bits - 1))) != 0) ?
+             ret | ~mask : ret);

Review Comment:
   Maybe there is a way to test simulation in 32bit docker environment and see 
if that brings a difference 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to