foxygit / fake-08-xbox360 Log in
commit abf1139f925fd5b05a87c7911525908d7541fb65
Author:     Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Thu Mar 11 19:04:15 2021 -0700
Commit:     Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Thu Mar 11 19:04:15 2021 -0700

    Add comment with potential optimization
---
 source/nibblehelpers.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/source/nibblehelpers.cpp b/source/nibblehelpers.cpp
index 02b265a..1271fc7 100644
--- a/source/nibblehelpers.cpp
+++ b/source/nibblehelpers.cpp
@@ -19,6 +19,11 @@ void setPixelNibble(int x, int y, uint8_t value, uint8_t* targetBuffer) {
 	value = mask == 0xf0 ? value << 4 : value;

 	targetBuffer[combinedIdx] = (currentByte & ~mask) | (value & mask);
+
+	//potentially slightly optimized by inlining - don't have measurements to back it up
+	//(BITMASK(0) & x) == 0
+	//	? targetBuffer[(y << 6) + (x >> 1)] = (targetBuffer[(y << 6) + (x >> 1)] & 0xf0) | (value & 0x0f)
+	//	: targetBuffer[(y << 6) + (x >> 1)] = (targetBuffer[(y << 6) + (x >> 1)] & 0x0f) | (value << 4 & 0xf0);
 }

 uint8_t getPixelNibble(int x, int y, uint8_t* targetBuffer) {