shithub: gpufs

Download patch

ref: d53100c1bdfb9036a824fa60cd2dd58d02120210
parent: b7ecf84c597a332ae0c1bb1534b61cfed573c92c
author: sirjofri <sirjofri@sirjofri.de>
date: Sun Feb 18 05:43:57 EST 2024

fixes strlen calculation for OpEntryPoint

--- a/dops.c
+++ b/dops.c
@@ -6,6 +6,13 @@
 
 extern int debug;
 
+int
+lstrlen(int len)
+{
+	int nlen = len + 1;
+	return (nlen)%4 == 0 ? (nlen/4) : (nlen/4)+1;
+}
+
 char *executionmodel[] = {
 	"Vertex",
 	"TessellationControl",
@@ -185,10 +192,9 @@
 	u32int emodel = f->pc[1];
 	u32int epoint = f->pc[2];
 	char *name = (char*)&f->pc[3];
-	int l = strlen(name)+1;
-	l = (l%4 == 0 ? l/4 : l/4+1);
-	u32int *argv = &f->pc[l+3];
-	u32int argc = len - (l+2);
+	int l = lstrlen(strlen(name)) + 3;
+	u32int *argv = &f->pc[l];
+	u32int argc = len - l;
 	
 	printresult(0, 0);
 	print("OpEntryPoint %s %%%d \"%s\"", getexecutionmodel(emodel), epoint, name);