Thanks,
I'll test which one is fastest and put that one into a function
User Profile
Collapse
-
using generic types
I have a function like
Code:UInt32[] MyFunction(UInt32[] Inputs, bool bOrder)
Code:<T>[] MyFunction(<T>[] Inputs, bool bOrder)
-
Somewhere I read about regular expressions and (based upon what I read) I managed to get this working:
Code:using System.Text.RegularExpressions; Regex Spaces = new Regex(@"\s+"); string[] Fields = Spaces.Split(Line.Trim()); if (Fields != null) {
Leave a comment:
-
reading values from strings
In memory I have a string containing numbers (ushorts) I want to read into an array.
Example :
string Line = " 1 12 15 12 8 21 ";
ushort[] Numbers = new ushort[6];
I want :
Numbers[0] = 1
Numbers[1] =12
Numbers[2] =15
Numbers[3] = 12
Numbers[4] = 8
Numbers[5] =21
How can I do that? -
How to CRLF in MessageBox
I would like to know how to put text over 2 (or several) lines in a messageBox
I tried MessageBox.Show ("Text-1" + "\\r\\n" + "text-2"); but that doesn't work -
Writing using same format in a loop
I want to write a number (will vary) of data using the same format on a single line like:
i know i can do this like:
LogWriter.Write Line();
for (i=0; i<Number; i++)
{
LogWriter.Write ("{0,3} ", Data[i]);
}
but that seems a bit clumsy to me
I would like to have this in ONE statement (or less 'long')
is this posisble? -
Creation of List<T>
i know how to create a simple list like
List<UInt32> Sets = new List<UInt32>();
and i can add simple UInt32 objects to it
but now I want to create a such a List<..> of small arrays consisting of 4 elements each of UIn32 so that i can add
UInt32[] Sets = new UInt32[4]; objects to it
how can i do what i want? -
How to enlarge console font
I have an old application using ANSI-escape sequences to display input and outputfields on a screen. I have to revive this without rewriting it working under XP. As the application gathers all info HOW to display the fields separated from actually displaying it I only have to change ONE module in order being able to handle about a 100 different 'screens'.
So I have a look at Console using C# and indeed I can size the console (mimicing... -
Sure you're right about .NET having huge overload and quite funny you mention Fortran as I've been using that for several decades "but it is oldfashioned"pe ople say.
Anyway I managed to findout myself (of course after searching the internet as well [but NOT finding])
What I came up is as far as I know faster bitcount function around:
public static ushort Count64(UInt64 BitMask)
...Leave a comment:
-
How to use "using"
I have following
namespace Mine.Bits
{
public static class Bits
{
static class Bits { static UInt64[] BitMasks;
static Bits(){ <generation of BitMasks> }
UInt64 BitMask(int i) { return BitMasks[i]}
}
In another file I specify
using Mine.Bits;
but despite that I have... -
Indeed I mean 'the number of 1s in an UInt64 I'm after". (but I thought 'bitcount' has bene used quite often for this; sometimes 'populationcoun t' or something like that; sorry being inaccurate in this)
No I don't think BitArray will be useful to me.
I have to evaluate a few MILLION times a UInt64 against over 10 million UInt64 s.
This can take several days.
And worse : I have to do that more or less regurlarly....Leave a comment:
-
c# Retrieving INDEX of a bit rather then its VALUE
I would like to retrieve the INDEX of a bit rather then its VALUE while scanning for MSB or LSB
Example from http://aggregate.org/MAGIC/#Most%20Signifi cant%201%20Bit:
unsigned int msb32(register unsigned int x)
{
x |= (x >> 1);
x |= (x >> 2);
x |= (x >> 4);
x |= (x >> 8);
x |= (x >> 16);
return(x &... -
c# Fast Bitcount for UInt64 needed
I need a fast bitcount for UInt64
My variables usually contain up to 8 bits set but regurlarly between 30 and 56.
At various places i found a fast one for UInt32 and on one site I even found a generalised version http://www.mathematik. uni-bielefeld.de/~sillke/PROBLEMS/bitcount (plus description).
The UInt32 version works fine but enhancing that by the line
w += w >> 32; simply doesn't work on my...
No activity results to display
Show More
Leave a comment: