From de802014606911660010b145bf778f3acf6772fb Mon Sep 17 00:00:00 2001 From: Baptiste Assmann Date: Sun, 29 Mar 2020 09:10:27 +0200 Subject: [PATCH] MINOR: ist: add istissame() function The istissame() function takes 2 ist and compare their <.ptr> and <.len> values respectively. It returns non-zero if they are the same. --- include/common/ist.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/common/ist.h b/include/common/ist.h index 2b647a2..8dd6615 100644 --- a/include/common/ist.h +++ b/include/common/ist.h @@ -751,6 +751,14 @@ static inline struct ist istadv(const struct ist ist, const size_t nb) return ist2(ist.ptr + nb, ist.len - nb); } +/* + * compare 2 ists and return non-zero if they are the same + */ +static inline int istissame(const struct ist ist1, const struct ist ist2) +{ + return ((ist1.ptr == ist2.ptr) && (ist1.len == ist2.len)); +} + #ifndef IST_FREESTANDING /* This function allocates bytes and returns an `ist` pointing to * the allocated area with size `0`. -- 1.7.10.4