From 3805e049386e704324395acc252c2cce218303a2 Mon Sep 17 00:00:00 2001 From: pavelyakov Date: Mon, 27 Apr 2020 20:18:23 +0000 Subject: [PATCH] CMM Array: new function indexArray git-svn-id: svn://kolibrios.org@7831 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/lib/array.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/programs/cmm/lib/array.h b/programs/cmm/lib/array.h index b3f621712f..84ca05b6e0 100644 --- a/programs/cmm/lib/array.h +++ b/programs/cmm/lib/array.h @@ -142,7 +142,7 @@ dword checkSum1 = 1; dword checkSum2 = 0; dword beginAddress = 0; - + beginAddress = text; WHILE(DSBYTE[text]) { @@ -173,4 +173,13 @@ RETURN array.init(size); } +dword indexArray(dword address, key) +{ + dword offset = key&11b; + dword offsetAddress = offset*4+address; + IF (key==offset) RETURN 4*4+offsetAddress; + IF (!DSDWORD[offsetAddress]) DSDWORD[offsetAddress] = malloc(4*4*2); + RETURN indexArray(DSDWORD[offsetAddress], key>>2); +} + #endif