1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-29 00:11:16 +01:00
Marian Buschsieweke 4b8881abb4
gnrc/netif/hdr.h: Optimized structure layout
Reordered struct members to not waste memory due to padding.

Before:
``` C
typedef struct {
    uint8_t src_l2addr_len;
    uint8_t dst_l2addr_len;
    kernel_pid_t if_pid;    // <-- 16 bit, is aligned to 16 bit
    uint8_t flags;
    uint8_t __padding_byte; // <-- Inserted to fulfill padding requirements
    int16_t rssi;           // <-- 16 bit, is NOT aligned to 16 bit
    uint8_t lqi;
    uint8_t __padding_byte2;// <-- Inserted to fulfill padding requirements
} gnrc_netif_hdr_t;
```

Now:
``` C
typedef struct {
    uint8_t src_l2addr_len;
    uint8_t dst_l2addr_len;
    kernel_pid_t if_pid;    // <-- 16 bit, is aligned to 16 bit
    uint8_t flags;
    uint8_t lqi;
    int16_t rssi;           // <-- 16 bit, is aligned to 16 bit
} gnrc_netif_hdr_t;
```

When build for the `bluepill` board, the new layout reduces the size by 2 bytes.
2018-05-14 14:01:29 +02:00
..
2017-10-20 15:02:41 +02:00
2015-07-07 17:49:17 +02:00
2017-09-01 09:35:48 +02:00
2018-04-05 14:39:59 +02:00
2017-06-16 16:50:54 +02:00
2017-06-16 16:50:54 +02:00
2018-04-05 14:39:59 +02:00
2018-02-28 10:02:03 +01:00
2018-03-22 15:21:01 +01:00
2016-10-26 21:53:58 +02:00
2015-08-21 23:30:04 +02:00
2017-10-20 15:02:41 +02:00
2016-10-26 21:53:58 +02:00
2017-12-12 07:51:39 +01:00
2017-05-24 17:54:02 +02:00
2017-07-04 14:44:17 +02:00
2018-02-09 14:29:45 +01:00