...that bit set. with control statements my code becomes
unsigned int foo;
int mask = 0x00000001;
int bit;
int bitcount = 0;
for(bit = 0; bit < 32; bit++)
{
bitcount += foo & mask >> bit;
mask = mask * 2;
}
"There are no stupid questions, just lots of inquisitive idiots" - anon
yep vnc, we use it at work a lot to remotely access a pc on a hardware bench from our desks. its kindof clunky over a regular 10/100 network with the usual amount of office traffic but if you've got a 1Gbps link it should work like a dream. also there are linux implementations for it, not sure...
Turns out my problem is the same as what happens in a cpus cache where lookups have to be done on code address but entries need to be selected for removal occasionally, anybody got any useful algorithms/implementations for this purpose. "There are no stupid questions, just lots of...
Open source software and security has always been an interesting combination. Microsoft would have us believe that because its open source it gives hackers an oportunity to exploit errors in the code. While this is true it gives maintainers many sources of feedback its almost a question of whats...
Before I start I will point out that rather than some programming problem from a course this is something I've run into at my job and any solution posted might get put into an actual product. Hopefully I'll be sufficiently vague to avoid any intelectual property issues. Here we go.
There is a...
basically what i'm trying to do is have output like
binary: 11111111111.....
hex: FFFFFFFF
decimal: 49388222 (whatever it is) not -123445677
but from looking at things i dont think that java does it. also the java.lang.Math class cant be extended because its final (i tried it with java 1.2...
theres the ncurses package available for most unix/linux distributions and i've seen a port for the cygwin windows based environent might be worth a look but a lot of these are not very portable. "There are no stupid questions, just lots of inquisitive idiots" - anon
Hi
Write embedded systems and have a lot of use for bit masks shifting etc. I wrote a java app that acts as a calculator and can take a hexadecimal number and tell me what bits are set i've added masking and shifting etc. What i what to do is get the output in decimal as well as hex but of...
I guess this isn't really the best place for this question but I couldn't find a better one. I work for a company that makes embedded systems one of our new products is going to have removeable compact flash. To facilitate portability between our product and others we wish to implement a FAT...
looks like it was a compiler optimisation thing that had more to do with registers than it did with shifting.
thanks
Chris Packham
If a tree falls in the woods and it hits Bill Gates does anyone care?
Bit of clarification all the numbers used are unsigned, and no i cant print out the values because its in a kernel routine so if i printed them out i'd get a whole heap of mess.
Chris Packham
If a tree falls in the woods and it hits Bill Gates does anyone care?
...bits of upper which have been shifted right 28 bits so the resultant number looks like this:
0xULLLLLLL. theres the code wee're using now
/*assume upper and lower have been loaded correctly and declared*/
lower = lower >> 4;
upper = upper << 28;
result = lower + upper;
return result;
Is...
I agree that Linux (or a descendant of it) will be around for years to come. NT doubtful, will Whistler (MS's new network/internet OS) even make much of a difference or will it be a spectacular failure like web tv.
Maybe its time hardware vendors started taking notice. Certainly most vendors...
if it is in the same directory doing what frag said is fine. things get complicated when you start using packages if you really want to know about using packages have a look at http://java.sun.com
Chris Packham
kriz@i4free.co.nz
A thousand mokeys at a thousand machines, it happened, it got...
Java in general is slower than other languages because it runs on a virtual machine. This has a positive side in that the same class you compiled on your windows pc can be run on a linux pc or a mac provided they have the relevant java virtual machine for their platform. The downside is that...
You had to pick chess. Good luck if you want to implement a computer player. I haven't actually done this but the general design would go something like this:
a board would be a 2 dimensional array (8 by 8, unless you want to do something different) of your superclass piece. Free spaces would...
Um well java is supposed to do garbage collecting automatically so as soon as you no longer use an object it should disappear from memory. What i've found is that java waits until the cpu utilisation goes down below a threshold before it does its garbage collecting, but java uses so much memory...
i think theres also a JTextPane which provides better functionality than a JTextArea. It is for some more whizzy word processing stuff but it may be better if your text is really huge have a look at http://java.sun.com/j2se/1.3/docs/api/index.html for more details.
Also with you JScrollPane...
thanks pete.
Has anyone actually done it on a real system? What happened would you do it again?
Chris Packham
kriz@i4free.co.nz
A thousand mokeys at a thousand machines, it happened, it got called the internet.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.