Dependencies:   NetServices

Dependents:   HvZ

Committer:
etherealflaim
Date:
Sun Dec 12 19:34:41 2010 +0000
Revision:
0:7e2eb93442e7

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
etherealflaim 0:7e2eb93442e7 1 #ifndef UTIL_H
etherealflaim 0:7e2eb93442e7 2 #define UTIL_H
etherealflaim 0:7e2eb93442e7 3
etherealflaim 0:7e2eb93442e7 4 #include "types.h"
etherealflaim 0:7e2eb93442e7 5 //#include "log.h"
etherealflaim 0:7e2eb93442e7 6
etherealflaim 0:7e2eb93442e7 7 /**
etherealflaim 0:7e2eb93442e7 8 \file util.h
etherealflaim 0:7e2eb93442e7 9 \brief Primary utility header
etherealflaim 0:7e2eb93442e7 10
etherealflaim 0:7e2eb93442e7 11 In addition to providing some utility functions, this file also includes
etherealflaim 0:7e2eb93442e7 12 the other utility headers automatically.
etherealflaim 0:7e2eb93442e7 13 */
etherealflaim 0:7e2eb93442e7 14
etherealflaim 0:7e2eb93442e7 15 /// Is any byte memory at start for bytes nonzero?
etherealflaim 0:7e2eb93442e7 16 inline bool is_nonzero_mem(u8 *start, unsigned int bytes)
etherealflaim 0:7e2eb93442e7 17 {
etherealflaim 0:7e2eb93442e7 18 for (; bytes--; ++start) if (*start) return true;
etherealflaim 0:7e2eb93442e7 19 return false;
etherealflaim 0:7e2eb93442e7 20 }
etherealflaim 0:7e2eb93442e7 21
etherealflaim 0:7e2eb93442e7 22 /// Are all bytes at start for bytes zero?
etherealflaim 0:7e2eb93442e7 23 inline bool is_zero_mem(u8 *start, unsigned int bytes)
etherealflaim 0:7e2eb93442e7 24 {
etherealflaim 0:7e2eb93442e7 25 for (; bytes--; ++start) if (*start) return false;
etherealflaim 0:7e2eb93442e7 26 return true;
etherealflaim 0:7e2eb93442e7 27 }
etherealflaim 0:7e2eb93442e7 28
etherealflaim 0:7e2eb93442e7 29 /// Are the memory locations at and and b equal for bytes?
etherealflaim 0:7e2eb93442e7 30 inline bool is_equal_mem(u8 *a, u8 *b, unsigned int bytes)
etherealflaim 0:7e2eb93442e7 31 {
etherealflaim 0:7e2eb93442e7 32 for (; bytes--; ++a, ++b) if (*a != *b) return false;
etherealflaim 0:7e2eb93442e7 33 return true;
etherealflaim 0:7e2eb93442e7 34 }
etherealflaim 0:7e2eb93442e7 35
etherealflaim 0:7e2eb93442e7 36 #endif