aboutsummaryrefslogtreecommitdiff
path: root/lib/sg_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sg_lib.c')
-rw-r--r--lib/sg_lib.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/sg_lib.c b/lib/sg_lib.c
index 7014a0eb..81ac1ddb 100644
--- a/lib/sg_lib.c
+++ b/lib/sg_lib.c
@@ -2586,6 +2586,28 @@ sg_is_big_endian()
the most significant byte */
}
+bool sg_all_zeros(const uint8_t * bp, int b_len)
+{
+ if ((NULL == bp) || (b_len <= 0))
+ return false;
+ for (--b_len; b_len >= 0; --b_len) {
+ if (0x0 != bp[b_len])
+ return false;
+ }
+ return true;
+}
+
+bool sg_all_ffs(const uint8_t * bp, int b_len)
+{
+ if ((NULL == bp) || (b_len <= 0))
+ return false;
+ for (--b_len; b_len >= 0; --b_len) {
+ if (0xff != bp[b_len])
+ return false;
+ }
+ return true;
+}
+
static uint16_t
swapb_uint16(uint16_t u)
{