Changeset 241ab7e in mainline
- Timestamp:
- 2021-08-08T22:34:38Z (3 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- edeee9f
- Parents:
- 2177b39
- Location:
- uspace/lib/inet
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/inet/include/inet/eth_addr.h
r2177b39 r241ab7e 74 74 extern const eth_addr_t eth_addr_broadcast; 75 75 76 extern void eth_addr_encode(eth_addr_t *, void*);77 extern void eth_addr_decode(const void*, eth_addr_t *);76 extern void eth_addr_encode(eth_addr_t *, uint8_t *); 77 extern void eth_addr_decode(const uint8_t *, eth_addr_t *); 78 78 79 79 extern int eth_addr_compare(const eth_addr_t *, const eth_addr_t *); -
uspace/lib/inet/src/eth_addr.c
r2177b39 r241ab7e 50 50 * @param buf Buffer (ETH_ADDR_SIZE bytes in size) to store bytes 51 51 */ 52 void eth_addr_encode(eth_addr_t *addr, void*buf)52 void eth_addr_encode(eth_addr_t *addr, uint8_t *buf) 53 53 { 54 uint8_t *bp = (uint8_t *)buf;55 54 uint64_t a; 56 55 int i; … … 59 58 60 59 for (i = 0; i < ETH_ADDR_SIZE; i++) 61 b p[i] = (a >> (40 - 8 * i)) & 0xff;60 buf[i] = (a >> (40 - 8 * i)) & 0xff; 62 61 } 63 62 … … 70 69 * @param addr Place to store Ethernet address 71 70 */ 72 void eth_addr_decode(const void*buf, eth_addr_t *addr)71 void eth_addr_decode(const uint8_t *buf, eth_addr_t *addr) 73 72 { 74 const uint8_t *bp = (uint8_t *)buf;75 73 uint64_t a; 76 74 int i; … … 78 76 a = 0; 79 77 for (i = 0; i < ETH_ADDR_SIZE; i++) 80 a |= (uint64_t)b p[i] << (40 - 8 * i);78 a |= (uint64_t)buf[i] << (40 - 8 * i); 81 79 82 80 addr->a = a;
Note:
See TracChangeset
for help on using the changeset viewer.