test icmp

Dependencies:   mbed

Fork of ethspam by Rolf Meyer

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers util.h Source File

util.h

Go to the documentation of this file.
00001 #ifndef UTIL_H
00002 #define UTIL_H
00003 
00004 #include "types.h"
00005 
00006 /**
00007   \file util.h
00008   \brief Primary utility header
00009   
00010   In addition to providing some utility functions, this file also includes
00011   the other utility headers automatically.
00012 */
00013 
00014 /// Is any byte memory at start for bytes nonzero?
00015 inline bool is_nonzero_mem(u8 *start, unsigned int bytes)
00016 {
00017   for (; bytes--; ++start) if (*start) return true;
00018   return false;
00019 }
00020 
00021 /// Are all bytes at start for bytes zero?
00022 inline bool is_zero_mem(u8 *start, unsigned int bytes)
00023 {
00024   for (; bytes--; ++start) if (*start) return false;
00025   return true;
00026 }
00027 
00028 /// Are the memory locations at and and b equal for bytes?
00029 inline bool is_equal_mem(u8 *a, u8 *b, unsigned int bytes)
00030 {
00031   for (; bytes--; ++a, ++b) if (*a != *b) return false;
00032   return true;
00033 }
00034 
00035 #endif