[dpdk-dev] [PATCH] librte_lpm: use field access instead of type conversion.

2015-02-13 Thread Xuelin Shi
Bruce Richardson [mailto:bruce.richardson at intel.com] > Sent: Thursday, February 12, 2015 19:18 > To: Shi Xuelin-B29237 > Cc: thomas.monjalon at 6wind.com; dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH] librte_lpm: use field access instead of > type conversion. > > On Wed, Feb 1

[dpdk-dev] [PATCH] librte_lpm: use field access instead of type conversion.

2015-02-12 Thread Bruce Richardson
On Wed, Feb 11, 2015 at 02:12:59PM +0800, xuelin.shi at freescale.com wrote: > From: Xuelin Shi > > struct tbl_entry{ > uint8_t next_hop; > uint8_t valid :1; > uint8_t valid_group :1; > uint8_t depth :6 > } > uint16_t tbl = (uint16_t)tbl_entry; > next_hop = (uint8_

[dpdk-dev] [PATCH] librte_lpm: use field access instead of type conversion.

2015-02-11 Thread xuelin....@freescale.com
From: Xuelin Shi struct tbl_entry{ uint8_t next_hop; uint8_t valid :1; uint8_t valid_group :1; uint8_t depth :6 } uint16_t tbl = (uint16_t)tbl_entry; next_hop = (uint8_t)tbl; next_hop cannot get the correct value of the field if the cpu arch is BIG_ENDIAN. change