net: Fix: left shift of 1 by 31 places cannot be represented in type 'long int'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: Id2daa60834f7b1917b15bbad89b091b59311e988
This commit is contained in:
parent
60da4317b9
commit
232d65c232
@ -75,7 +75,7 @@ FAR struct net_driver_s *netdev_findbyindex(int ifindex)
|
|||||||
#ifdef CONFIG_NETDEV_IFINDEX
|
#ifdef CONFIG_NETDEV_IFINDEX
|
||||||
/* Check if this index has been assigned */
|
/* Check if this index has been assigned */
|
||||||
|
|
||||||
if ((g_devset & (1L << (ifindex - 1))) == 0)
|
if ((g_devset & (1UL << (ifindex - 1))) == 0)
|
||||||
{
|
{
|
||||||
/* This index has not been assigned */
|
/* This index has not been assigned */
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ int netdev_nextindex(int ifindex)
|
|||||||
net_lock();
|
net_lock();
|
||||||
for (; ifindex < MAX_IFINDEX; ifindex++)
|
for (; ifindex < MAX_IFINDEX; ifindex++)
|
||||||
{
|
{
|
||||||
if ((g_devset & (1L << ifindex)) != 0)
|
if ((g_devset & (1UL << ifindex)) != 0)
|
||||||
{
|
{
|
||||||
/* NOTE that the index + 1 is returned. Zero is reserved to
|
/* NOTE that the index + 1 is returned. Zero is reserved to
|
||||||
* mean no-index in the POSIX standards.
|
* mean no-index in the POSIX standards.
|
||||||
|
@ -189,7 +189,7 @@ static int get_ifindex(void)
|
|||||||
|
|
||||||
for (ndx = 0; ndx < MAX_IFINDEX; ndx++)
|
for (ndx = 0; ndx < MAX_IFINDEX; ndx++)
|
||||||
{
|
{
|
||||||
uint32_t bit = 1L << ndx;
|
uint32_t bit = 1UL << ndx;
|
||||||
if ((devset & bit) == 0)
|
if ((devset & bit) == 0)
|
||||||
{
|
{
|
||||||
/* Indicate that this index is in use */
|
/* Indicate that this index is in use */
|
||||||
|
Loading…
Reference in New Issue
Block a user