?"1 << core" will fail if core >= 32, hence "1ull << core" is needed.

problem is, this will only work for core_id < 64, but that may not always be 
the case,

e.g. if there are more than 64 cores, or if core number are not contiguous.


________________________________
From: [email protected] <[email protected]> on 
behalf of Bill Fischofer <[email protected]>
Sent: Tuesday, September 16, 2014 5:13 PM
To: Mike Holmes
Cc: [email protected]
Subject: Re: [lng-odp] [PATCH] odp_coremask.c: Use 1ULL for 64bit shifts

Is this necessary?  1 == 1ULL in this context.

Bill

PS Glad to see you're coherent/bored enough to be working :)

On Tuesday, September 16, 2014, Mike Holmes 
<[email protected]<mailto:[email protected]>> wrote:
Signed-off-by: Mike Holmes <[email protected]>
---

Unless specified "1" is taken as 32bits and core can be upto 63

 platform/linux-generic/odp_coremask.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/odp_coremask.c 
b/platform/linux-generic/odp_coremask.c
index c55eb72..c7438cc 100644
--- a/platform/linux-generic/odp_coremask.c
+++ b/platform/linux-generic/odp_coremask.c
@@ -64,7 +64,7 @@ void odp_coremask_set(int core, odp_coremask_t *mask)
                return;
        }

-       mask->_u64[0] |=  (1 << core);
+       mask->_u64[0] |=  (1ULL << core);
 }

 void odp_coremask_clr(int core, odp_coremask_t *mask)
@@ -77,7 +77,7 @@ void odp_coremask_clr(int core, odp_coremask_t *mask)
                return;
        }

-       mask->_u64[0] &= ~(1 << core);
+       mask->_u64[0] &= ~(1ULL << core);
 }


--
1.9.1


_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to