From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Green Subject: [PATCH v2 18/24] rte_ether.h: explicit cast avoiding truncation warning Date: Fri, 11 May 2018 10:00:25 +0800 Message-ID: <152600402504.54839.6899771885890089022.stgit@localhost.localdomain> References: <152600382101.54839.18392182958431211001.stgit@localhost.localdomain> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: dev@dpdk.org Return-path: Received: from mail.warmcat.com (mail.warmcat.com [163.172.24.82]) by dpdk.org (Postfix) with ESMTP id BAE9E1C173 for ; Fri, 11 May 2018 04:00:28 +0200 (CEST) In-Reply-To: <152600382101.54839.18392182958431211001.stgit@localhost.localdomain> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" /projects/lagopus/src/dpdk/build/include/rte_ether.h:213:13: warning: conversion from 'int' to 'uint8_t' {aka 'unsigned char'} may change value [-Wconversion] addr[0] &= ~ETHER_GROUP_ADDR; /* clear multicast bit */ Signed-off-by: Andy Green --- lib/librte_net/rte_ether.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index 95d0a533f..01d57f0ae 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -210,7 +210,7 @@ static inline void eth_random_addr(uint8_t *addr) uint8_t *p = (uint8_t *)&rand; rte_memcpy(addr, p, ETHER_ADDR_LEN); - addr[0] &= ~ETHER_GROUP_ADDR; /* clear multicast bit */ + addr[0] &= (uint8_t)~ETHER_GROUP_ADDR; /* clear multicast bit */ addr[0] |= ETHER_LOCAL_ADMIN_ADDR; /* set local assignment bit */ }