# HG changeset patch # User František Kučera # Date 1514499103 -3600 # Node ID b63d62c675fe8da1bb87cd062ab9a7156b502785 # Parent 2b3a26d3b1ad1a8cc3bf7bb53e9b8493f83d75f7 do not pass by reference arguments of small types diff -r 2b3a26d3b1ad -r b63d62c675fe c++/rgb-assembler/Memory.h --- a/c++/rgb-assembler/Memory.h Wed Dec 27 11:34:09 2017 +0100 +++ b/c++/rgb-assembler/Memory.h Thu Dec 28 23:11:43 2017 +0100 @@ -23,7 +23,7 @@ class Memory { private: - template T logMemoryError(const address_t &index) { + template T logMemoryError(const address_t index) { wprintf(L"memory error: index = %d, sizeof(T) = %d, MEMORY_SIZE = %d\n", index, sizeof (T), memorySize); // TODO: return error value or throw exception return T(); @@ -64,7 +64,7 @@ * Reads data on given position in memory (without affecting the current position). * @return value found at given position */ - template T read(const address_t &address) { + template T read(const address_t address) { // TODO: map higher memory to static hardcoded areas or peripherals if (address + sizeof (T) <= memorySize) { return *(reinterpret_cast (memory + address)); @@ -91,7 +91,7 @@ * Writes data to given position in memory (without affecting the current position). * @param value value to be written at given position */ - template void write(const address_t &address, const T value) { + template void write(const address_t address, const T value) { if (address + sizeof (T) <= memorySize) { T * m = reinterpret_cast (memory + address); *m = value; @@ -104,7 +104,7 @@ * Set current addres to given position. * @param index */ - void setAddress(address_t &index) { + void setAddress(address_t index) { this->index = index; }