diff --git a/include/intelhex.h b/include/intelhex.h index 428a701..714fc44 100644 --- a/include/intelhex.h +++ b/include/intelhex.h @@ -11,6 +11,7 @@ #include #include +#include namespace intelhex { @@ -67,7 +68,7 @@ namespace intelhex value_type& operator[](address_type); //Array access operator value_type get(address_type); // Return the value at address - void set(address_type, value_type); // Set the value at address + void set(address_type, value_type, bool ignore_fill=false); // Set the value at address void load(const std::string&); // Load from a file void read(std::istream &); // Read data from an input stream diff --git a/src/intelhex.cc b/src/intelhex.cc index e7d01cb..6b34659 100644 --- a/src/intelhex.cc +++ b/src/intelhex.cc @@ -56,9 +56,9 @@ namespace intelhex } // Set the value at address or create a new element using value - void hex_data::set(address_type address, value_type value) + void hex_data::set(address_type address, value_type value, bool ignore_fill) { - if( value == fill() ) // Handle fill values + if( !ignore_fill && value == fill() ) // Handle fill values { erase(address); // If the address is already set, erase it return;