Originally posted by SupremeSpod
View Post
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Reply to: Who'd be a game dev...
Collapse
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
- You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
- You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
- If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Logging in...
Previously on "Who'd be a game dev..."
Collapse
-
Originally posted by aussielong View PostRight shifting a negative signed integer is undefined. Or rather , the result is platform and compiler dependent.
You wouldn't be interviewing me pal.
Leave a comment:
-
Originally posted by SupremeSpod View PostSo, by your logic...
unsigned int a = 4;
a = a >> 1;
The answer could be unpredictable? Sorry mate you failed the interview.
You wouldn't be interviewing me pal.
Leave a comment:
-
Originally posted by aussielong View PostIt doesn't matter if you are only after the lower bits. It's faster than padding unnecessarily.
Another bloke who does not know his limitations.
unsigned int a = 4;
a = a >> 1;
The answer could be unpredictable? Sorry mate you failed the interview.
Leave a comment:
-
Originally posted by d000hg View PostI think it's a bit over the line trolling on technical stuff like AL is doing, people might think he's correct and muck up their work!
Leave a comment:
-
I think it's a bit over the line trolling on technical stuff like AL is doing, people might think he's correct and muck up their work!
Leave a comment:
-
I'm with DA on this one, reading this thread is interesting but also completely over my head. Can someone give a small example of >> << <<< and >>> in some code please so I have a better chance of actually keeping up
Leave a comment:
-
Originally posted by SupremeSpod View PostHow can you leave the top bits undefined? You'd **** the value up.
Spod - In "I ******* Despair" mode!
Another bloke who does not know his limitations.
Leave a comment:
-
Originally posted by aussielong View PostThese operators make it fast to multiply and divide by powers of 2, which can be done using others operators, clearly. Some compilers will replace a multiply by 2 with a bit shift to the right.
You get 0 padding if you use >>>, I think with >> you don't... Which leaves the top bits undefined after the shift.
Spod - In "I ******* Despair" mode!
Leave a comment:
-
Originally posted by VectraMan View PostYou are wrong.
How do you tell the compiler to do a bit shift, other than using the bitshift operators? And then what does it optimise it to?
Well now you're just making stuff up. What does it pad with if it's not 0? 1?
If it's a signed value, and you shift right, it pads with 0 if positive or 1 if negative. If it's unsigned, it pads with 0. Java seems to have two seperate >> and >>> operators, for some inexplicable reason.
You get 0 padding if you use >>>, I think with >> you don't... Which leaves the top bits undefined after the shift.
This shouldn't be in general really should it.Last edited by aussielong; 15 August 2012, 17:10.
Leave a comment:
-
Originally posted by VectraMan View PostYou are wrong.
How do you tell the compiler to do a bit shift, other than using the bitshift operators? And then what does it optimise it to?
Well now you're just making stuff up. What does it pad with if it's not 0? 1?
If it's a signed value, and you shift right, it pads with 0 if positive or 1 if negative. If it's unsigned, it pads with 0. Java seems to have two seperate >> and >>> operators, for some inexplicable reason.
Leave a comment:
-
Was ANY part of AL's post accurate
Although a compiler COULD change a multiplication/division into a shift operation if it wanted to, if you are multiplying by a constant e.g x *= 32.
Leave a comment:
-
Originally posted by aussielong View Post>> is from C++, I don't recall seeing it in C but I haven't programmed in C for 15 years so I could be wrong.
I don't think it's used much because the compiler should do it for you these days anyway and I guess with fast hardware these days, getting the last millisecond performance out of the code is not most peoples concern.
>>> is C++ too. I think it similar to >> but one pads with 0 and one doesn't. Java is going back to C++ with increasingly complicated and ugly syntax.
If it's a signed value, and you shift right, it pads with 0 if positive or 1 if negative. If it's unsigned, it pads with 0. Java seems to have two seperate >> and >>> operators, for some inexplicable reason.Last edited by VectraMan; 15 August 2012, 12:07.
Leave a comment:
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Are CVs medieval or just being misused? Sep 24 05:05
- Are CVs medieval or just being misused? Today 21:05
- IR35: Mutuality Of Obligations — updated for 2025/26 Today 05:22
- Only proactive IT contractors can survive recruitment firm closures Yesterday 07:32
- How should a creditors’ meeting ideally pan out for unpaid suppliers? Sep 19 07:16
- How should a creditors’ meeting ideally pan out for unpaid suppliers? Sep 18 21:16
- IR35: Substitution — updated for 2025/26 Sep 18 05:45
- Payment request to bust recruitment agency — free template Sep 16 21:04
- Why licensing umbrella companies must be key to 2027’s regulation Sep 16 13:55
- Top 5 Chapter 11 JSL myths contractors should know Sep 15 03:46
Leave a comment: