|
-
May 18th, 2010, 11:22 AM
#1
[RESOLVED] 64bit index for an array
Can I use Long for array indexing?
If no what could be done to manipulate large byte arrays (>32bit)?
-
May 18th, 2010, 11:27 AM
#2
Re: 64bit index for an array
Hey cicatrix, As the Array class has a public property name LongLength I'd say you can.
I didn't test it though.
Alex
.NET developer
"No. Not even in the face of Armageddon. Never compromise." (Walter Kovacs/Rorschach)
Things to consider before posting.
Don't forget to rate the posts if they helped and mark thread as resolved when they are.
.Net Regex Syntax (Scripting) | .Net Regex Language Element | .Net Regex Class | DateTime format | Framework 4.0: what's new
My fresh new blog : writingthecode, even if I don't post much.
System: Intel i7 920, Kingston SSDNow V100 64gig, HDD WD Caviar Black 1TB, External WD "My Book" 500GB, XFX Radeon 4890 XT 1GB, 12 GBs Tri-Channel RAM, 1x27" and 1x23" LCDs, Windows 10 x64, ]VS2015, Framework 3.5 and 4.0 
-
May 18th, 2010, 11:57 AM
#3
Re: 64bit index for an array
A workaround is to use a 2d array, for example MyArray(1, Integer.MaxValue). As you can see, this array has 2 "rows" and each row has integer.maxvalue elements. So it can hold twice as much data as a single 1d array. Now, to address an element given an int64 value as the index, you can use division and Mod to get the column and row index.
For example,
Code:
Dim myarray(1, integer.maxvalue) as Byte
Dim longIndex as Int64 = 123456789
Dim column as integer = longindex Mod integer.maxvalue
Dim row as Integer = longindex \ integer.maxvalue
Dim myByte as Byte = myarray(row, column)
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
May 18th, 2010, 12:00 PM
#4
Re: 64bit index for an array
 Originally Posted by stanav
A workaround is to use a 2d array, for example MyArray(1, Integer.MaxValue). As you can see, this array has 2 "rows" and each row has integer.maxvalue elements. So it can hold twice as much data as a single 1d array. Now, to address an element given an int64 value as the index, you can use division and Mod to get the column and row index.
Welcome back to the days of segment offset memory architecture
My usual boring signature: Nothing
 
-
May 18th, 2010, 12:08 PM
#5
Re: 64bit index for an array
An array with more memory than my old laptop! Cool.
-
May 18th, 2010, 01:47 PM
#6
Re: 64bit index for an array
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|