It came up in an interview today when SAR (shift arithmetic right) is used instead of SHR (shift and rotate right) the simple rule (on gcc at least and probably cl) if it’s a signed it will use SAR and not SHR. Makes total sense of course after looking at it. Left shift is always SHL regardless of sign.
int a = 0x80000000;
int b = 0x00000001;
a = a >> 5;
b = b << 5;
Produces:
movl $0x80000000,-0x4(%rbp)
movl $0x1,-0x8(%rbp)
sarl $0x5,-0x4(%rbp)
shll $0x5,-0x8(%rbp)
After shifting the variable will be: 0xfc000000
This sometimes surprises some people who assume that shifting is always the rotate shift operation (that shifts in zeros)
WikiBooks Shift and Rotate
I’m happy at how artshow is coming along. It feels ‘done’ and as a learning tool has been the perfect scope of project. I think if I would have done something more ambitious it would have been more difficult to bring it to completion (like the majority of my projects in svn).
Here’s the way it’s setup:
- Simple PHP page that queries the wordpress database for the wp_postmetadata for images matching a certain prefix and returns the wierd WP formatted metadata via an AJAX JSON query.
- The main frame is basically a single div to bind to raphaeljs
- The image metadata is parsed and put into a local js object cache and the SVG is built-up using the raphael js API.
- The UI is all javascript driven using the animation framework in raphael
You can play with it and see the code here:
http://xenopod.net/artshow.html
Art is by Joe Peterson.
It works on the iPhone/iPad as it is fully web compliant. Much thanks to the Jquery and RaphaelJS libraries for covering me on the front. I really don’t want to bother with browser compatibility.
I’ve been learning some more web programming, something that I’ve traditionally stayed partially removed from. I’m building a SVG based image gallery for a friend (http://xenopod.net). I’ve already done two rewrites as I’ve been learning how not to write javascript. So far I’ve been primarily using RaphaelJS and JQuery. I’m hoping to have a version up that I can be happy with soon.
Posted in uncategorized
|
Tagged music
|
I’ve been learning SC2 with the help of the guys at work and have been slowing improving my skills. I finally got out of the bottom division! woot feels good, such a good matchmaking implementation

So I finally got my computer back to functioning. The speaker and optical drive are now repaired. The screen is still not 100% but whatever I’m just don’t have the energy to deal with them any more. So here’s my main piece of advice for people taking their machines into the Apple retail outlets for repair.
Do not sign anything until you have completely inspected the machine yourself.
Yeah it’s a pain, and they’ll probably try and get you to sign off on the repair without inspecting it. Bring a disc, your iPod or whatever it is you do with your machine and just do it right there. Have them leave you at the counter while you run your machine through it’s paces. If your experience is anything like mine you have a very high probability of finding a flaw in the repair.
I recently bought a 17″ MacBook Pro to use a primary workstation for audio, programming etc. Soon after I completely abandoned any plans for releasing iPhone or iPad software because of Apple’s completely unacceptable TOS for iPhone developers. A few months later the shiny new Mac completely stopped functioning.
So there I was with a completely busted laptop. I wasn’t too worried, I had bought an Apple Care plan and figured the repair would be covered. I made my first appointment with their “Geniuses” (another example of Apple totally over-selling themselves) over the phone and took my machine in a few days later. According to online reviews not all Apple stores are good for repairs, some such as the Irvine Spectrum look down on broken machines and don’t provide good service. I took mine to South Coast Plaza in Costa Mesa. After waiting in line for fifteen minutes for an appointment I booked days in advance they prepare the bad news for me. After touching the power button to no avail my friendly “Genius” tells me that it’s being shipped off for repair, that my data is probably not going to make it. Fortunately I can get my data off the machine but it will be “VERY” expensive and Apple wont’ do it. Thanks dude, I tell him to screw it, I’m prepared to lose 6 months of music, my code is backed up in source control – I’m an idiot for not taking better backups.
So a week later my laptop is back in the Apple store good as new, or so they tell me. Guy hands me my laptop and prepares to send me off but I insist on testing it first. Sure enough the bottom part of the screen is covered in a tiger stripe pattern. Lovely quality control guys. “Oh you can fix that by resetting the PRAM” says the Genius. Mmmhmm. No that’s not going to work, at all. “Well you’re going to have to make another appointment to get a repair” he tells me. I’m certainly not happy by this point. I have two small children with me and am not looking forward to spending 3 hours in a mall just to talk to another Genius so they can take back the laptop that they couldn’t fix right the first time.
Next meeting with a Genius 3 hours later. I’m told that the laptop will be on rush that I should get it back in days because they are fixing it in-house. That promise came and went a few times as the rush repair stretched out to another 5 days. I drive back in to get my laptop and everything looks good. So I take it home. Big mistake, I really should have learned the first time that Apple repair has little to no quality control. The optical drive is not functioning and I have one functioning speaker.
So here I am finally mad enough to write a post about it. I used to be a fan, I spent a lot of time as a kid cutting my programming teeth on the Apple Classic, IIgs and IIci but I think Apple has really lost it. Not only have they lost my heart as a developer they’ve now lost my confidence as a consumer.
Apple I’m over you.