Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site isucs1.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!stolaf!umn-cs!isucs1!justice From: justice@isucs1.UUCP Newsgroups: net.unix-wizards Subject: Weird code Message-ID: <468@isucs1.UUCP> Date: Tue, 15-Oct-85 04:04:32 EDT Article-I.D.: isucs1.468 Posted: Tue Oct 15 04:04:32 1985 Date-Received: Thu, 17-Oct-85 01:28:52 EDT Sender: notes@isucs1.UUCP Organization: Iowa State University Lines: 57 Nf-ID: #N:isucs1:17700012:000:1146 Nf-From: isucs1!justice Oct 14 15:43:00 1985 Ok you wizards out there, why does this program do what it does? Here are a couple of hints: 1) It only works on Vaxes 2) The same idea is used to initialize the UNIBUS adapters --------------Here is a script showing the details------------------------ Script started on Mon Oct 14 14:08:05 1985 % cat reg.c main() { register int x, y; int i; int func(); fix((int *)func); x = 1; y = 5; for (i = 1; i <= 10; i++) { func(1,5); printf("x = %d, y = %d\n",x,y); } } func(x,y) int x,y; { register int a,b; a += a; b *= 5; x--; y++; } fix(f) int *f; { *f &= ~0xc00; } % cc reg.c -N -o reg % reg x = 2, y = 25 x = 4, y = 125 x = 8, y = 625 x = 16, y = 3125 x = 32, y = 15625 x = 64, y = 78125 x = 128, y = 390625 x = 256, y = 1953125 x = 512, y = 9765625 x = 1024, y = 48828125 % exit % script done on Mon Oct 14 14:08:29 1985 -------------------------------------------------------------------------- Good luck! Brian Justice, Iowa State University UUCP: {okstate||umn-cs||csu-cs}!isucs1!justice CSNET: justice@iowa-state