Click here to Skip to main content
15,564,500 members
Home / Discussions / C#
   

C#

 
QuestionCookie-less Authentication Pin
Rahithi6-Jan-07 18:42
Rahithi6-Jan-07 18:42 
AnswerRe: Cookie-less Authentication Pin
Christian Graus6-Jan-07 21:04
mveChristian Graus6-Jan-07 21:04 
QuestionIssues with RemoveChild() Pin
csharpk0der1236-Jan-07 18:23
csharpk0der1236-Jan-07 18:23 
AnswerRe: Issues with RemoveChild() Pin
Christian Graus6-Jan-07 21:07
mveChristian Graus6-Jan-07 21:07 
AnswerRe: Issues with RemoveChild() Pin
Luc Pattyn7-Jan-07 10:15
sitebuilderLuc Pattyn7-Jan-07 10:15 
QuestionI cant seem to think today. Pin
Captain See Sharp6-Jan-07 17:56
Captain See Sharp6-Jan-07 17:56 
AnswerRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 19:18
sitebuilderLuc Pattyn6-Jan-07 19:18 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 19:43
Captain See Sharp6-Jan-07 19: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 20:02
sitebuilderLuc Pattyn6-Jan-07 20:02 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 20:34
Captain See Sharp6-Jan-07 20:34 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 21:04
sitebuilderLuc Pattyn6-Jan-07 21:04 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 21:23
Captain See Sharp6-Jan-07 21:23 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 21:27
sitebuilderLuc Pattyn6-Jan-07 21:27 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 21:32
Captain See Sharp6-Jan-07 21:32 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 21:53
sitebuilderLuc Pattyn6-Jan-07 21:53 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 22:04
Captain See Sharp6-Jan-07 22:04 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 8:20
sitebuilderLuc Pattyn7-Jan-07 8:20 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 8:25
Captain See Sharp7-Jan-07 8:25 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 8:34
Captain See Sharp7-Jan-07 8:34 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 8:43
sitebuilderLuc Pattyn7-Jan-07 8:43 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 8:59
Captain See Sharp7-Jan-07 8:59 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 9:51
sitebuilderLuc Pattyn7-Jan-07 9:51 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 10:29
Captain See Sharp7-Jan-07 10:29 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 10:48
sitebuilderLuc Pattyn7-Jan-07 10:48 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 20:11
sitebuilderLuc Pattyn6-Jan-07 20: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.