shithub: rgbds

Download patch

ref: 4d2379b3dff221b11302ec51ef69be3f53cfd93e
parent: fd32b2252fe6652e9e4ddd3e033351e3a217c8db
author: ISSOtm <eldredhabert0@gmail.com>
date: Mon Feb 3 15:19:30 EST 2020

Merge both "single-side" code paths in `placeSection`

--- a/src/link/assign.c
+++ b/src/link/assign.c
@@ -281,13 +281,12 @@
 			/* Set the original space's new parameters */
 			freeSpace->size = section->org - freeSpace->address;
 			/* address is unmodified */
-		} else if (noLeftSpace) {
-			/* The free space is only moved and resized */
-			freeSpace->address += section->size;
-			freeSpace->size -= section->size;
 		} else {
-			/* The free space is only resized */
+			/* The amount of free spaces doesn't change: resize! */
 			freeSpace->size -= section->size;
+			if (noLeftSpace)
+				/* The free space is moved *and* resized */
+				freeSpace->address += section->size;
 		}
 		return;
 	}