Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
User Journal

Journal Journal: Hakmem Item 154

I'm curious whether Hakmem Item 154 works when not written in assembler. If you have access to a machine that you believe does not do twos-complement arithmetic, please run the following C99 program and report the results:

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
static char*char2bin(register char x){char*r=(char*)malloc(sizeof(char)*8);assert(r!=NULL);for(register int i=1;i<9;++i,x>>=1)if((bool)(x&1))r[8-i]='1'; else r[8-i]='0';return r;}int main(){char*x=char2bin((char)0xFF+(char)0xFF); assert(x!=NULL);printf("%s\n",x);free(x);return EXIT_SUCCESS;}

(There are no system calls in there, so I think you should trust me even if you don't know exactly what it's doing.)

User Journal

Journal Journal: I Wrote a Letter Today

20th Century Fox Home Videos
PO Box 900
Beverly Hills, CA 90213-0900
USA

Dear Sir or Madam:

I am writing in the hopes that you can inform me when to expect a release of the Fox television series Millennium on.If no release date is planned, may I encourage your organisation to schedule it as soon as possible so that fans like myself do not have to resort to downloading bootleg copies in violation of your copyrights.

Slashdot Top Deals

Our OS who art in CPU, UNIX be thy name. Thy programs run, thy syscalls done, In kernel as it is in user!

Working...