diff --git a/NEWS b/NEWS index 2430fa115c..da3ea1342a 100644 --- a/NEWS +++ b/NEWS @@ -379,6 +379,10 @@ CHANGES WITH 240 in spe: interface names even as systemd/udev are updated and the naming logic is improved. + * sd-id128.h learnt two new auxiliary helpers: sd_id128_is_allf() and + SD_ID128_ALLF to test if a 128bit ID is set to all 0xFF bytes, and to + initialize one to all 0xFF. + Contributions from: afg, Alan Jenkins, Aleksei Timofeyev, Alexander Filippov, Alexander Kurtz, Alexey Bogdanenko, Andreas Henriksson, Andrew Jorgensen, Anita Zhang, apnix-uk, Arkan49, Arseny Maslennikov, diff --git a/src/systemd/sd-id128.h b/src/systemd/sd-id128.h index 59f375bef5..f4c05a3683 100644 --- a/src/systemd/sd-id128.h +++ b/src/systemd/sd-id128.h @@ -110,7 +110,12 @@ _sd_pure_ static __inline__ int sd_id128_is_null(sd_id128_t a) { return a.qwords[0] == 0 && a.qwords[1] == 0; } +_sd_pure_ static __inline__ int sd_id128_is_allf(sd_id128_t a) { + return a.qwords[0] == UINT64_C(0xFFFFFFFFFFFFFFFF) && a.qwords[1] == UINT64_C(0xFFFFFFFFFFFFFFFF); +} + #define SD_ID128_NULL ((const sd_id128_t) { .qwords = { 0, 0 }}) +#define SD_ID128_ALLF ((const sd_id128_t) { .qwords = { UINT64_C(0xFFFFFFFFFFFFFFFF), UINT64_C(0xFFFFFFFFFFFFFFFF) }}) _SD_END_DECLARATIONS;