Click here to Skip to main content
15,891,513 members
Home / Discussions / C#
   

C#

 
QuestionCookie-less Authentication Pin
Rahithi6-Jan-07 17:42
Rahithi6-Jan-07 17:42 
AnswerRe: Cookie-less Authentication Pin
Christian Graus6-Jan-07 20:04
protectorChristian Graus6-Jan-07 20:04 
QuestionIssues with RemoveChild() Pin
csharpk0der1236-Jan-07 17:23
csharpk0der1236-Jan-07 17:23 
AnswerRe: Issues with RemoveChild() Pin
Christian Graus6-Jan-07 20:07
protectorChristian Graus6-Jan-07 20:07 
AnswerRe: Issues with RemoveChild() Pin
Luc Pattyn7-Jan-07 9:15
sitebuilderLuc Pattyn7-Jan-07 9:15 
QuestionI cant seem to think today. Pin
Captain See Sharp6-Jan-07 16:56
Captain See Sharp6-Jan-07 16:56 
AnswerRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 18:18
sitebuilderLuc Pattyn6-Jan-07 18:18 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 18:43
Captain See Sharp6-Jan-07 18:43 
Well thanks for the information. I think I will stick to the single threaded version of my method until I do more research. I didn't even think about the cache and aligning the data. Frown | :( I wanted to get the absolute max performance I could but it seems that will be much more complex than I thought it would. Here is the single threaded version. Its much simpler.

/// <summary>
/// Finds the ranges that may be in a sorted array of indexes. A range is one or more indexes that increment
/// by one, an array containing 6,7,8,10,400,401,402 contains three ranges 6-8, 10, and 400-402.
/// </summary>
/// <param name="indexes">A sorted array of indexes to search.</param>
/// <returns>An array of Ranges.</returns>
public Range[] FindIndexRanges(long[] indexes)
{
if (indexes.LongLength == 0)
return new Range[0];

if (indexes.LongLength == 1)
return new Range[] { new Range(indexes[0], indexes[0]) };

Range[] ranges = new Range[1];
bool resize = false; //this should be true after 1 range has been found
long firstIndex = indexes[0];
long lastIndex = indexes[0];

for (long i = 1; i < indexes.LongLength; i++)
{
if (indexes[i] == indexes[i - 1] + 1)
{
lastIndex++;
if (i != indexes.LongLength - 1)
continue;
}

if (resize)
Array.Resize<Range>(ref ranges, ranges.Length + 1);

ranges[ranges.Length - 1] = new Range(firstIndex, lastIndex);

firstIndex = lastIndex = indexes[i];

resize = true;
}
return ranges;
}


&#9608;&#9618;&#9618;&#9618;&#9618;&#9618;&#9608;&#9608;&#9618;&#9608;&#9618;&#9608;&#9608;
&#9608;&#9618;&#9608;&#9608;&#9608;&#9608;&#9608;&#9618;&#9618;&#9618;&#9618;&#9618;&#9608;
&#9608;&#9618;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9618;&#9608;&#9618;&#9608;&#9608;
&#9608;&#9618;&#9608;&#9608;&#9608;&#9608;&#9608;&#9618;&#9618;&#9618;&#9618;&#9618;&#9608;
&#9608;&#9618;&#9618;&#9618;&#9618;&#9618;&#9608;&#9608;&#9618;&#9608;&#9618;&#9608;&#9608;

GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 19:02
sitebuilderLuc Pattyn6-Jan-07 19:02 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 19:34
Captain See Sharp6-Jan-07 19:34 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 20:04
sitebuilderLuc Pattyn6-Jan-07 20:04 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 20:23
Captain See Sharp6-Jan-07 20:23 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 20:27
sitebuilderLuc Pattyn6-Jan-07 20:27 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 20:32
Captain See Sharp6-Jan-07 20:32 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 20:53
sitebuilderLuc Pattyn6-Jan-07 20:53 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 21:04
Captain See Sharp6-Jan-07 21:04 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 7:20
sitebuilderLuc Pattyn7-Jan-07 7:20 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 7:25
Captain See Sharp7-Jan-07 7:25 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 7:34
Captain See Sharp7-Jan-07 7:34 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 7:43
sitebuilderLuc Pattyn7-Jan-07 7:43 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 7:59
Captain See Sharp7-Jan-07 7:59 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 8:51
sitebuilderLuc Pattyn7-Jan-07 8:51 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 9:29
Captain See Sharp7-Jan-07 9:29 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 9:48
sitebuilderLuc Pattyn7-Jan-07 9:48 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 19:11
sitebuilderLuc Pattyn6-Jan-07 19:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.