Fix 2001/herrmann2 for 64-bit and 32-bit
By chance I looked at this entry again and it immediately popped into my head how to get it to work. Except for the one in main() the ints need to be longs. This will now compile and work as expected both with 64-bit and 32-bit compilation. Disabled make alt and updated .gitignore.
This commit is contained in:
1 parent
104a8496e7
commit
1d54238e18
5 files changed
+10
-239
No files matched your search
@@ -1,2 +1 @@
|
||||
herrmann2
|
||||
herrmann2.alt
|
||||
@@ -114,8 +114,8 @@ OBJ= ${PROG}.o
|
||||
DATA= herrmann2.cup herrmann2.ioccc
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ= ${PROG}.alt.o
|
||||
ALT_TARGET= ${PROG}.alt
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
|
||||
#################
|
||||
@@ -130,7 +130,7 @@ all: data ${TARGET}
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
${CC} ${CFLAGS} -m32 $< -o $@ ${LIBS}
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
# Most eye-crossing
|
||||
|
||||
Immanuel Herrmann
|
||||
University of Freiburg, Germany
|
||||
Rehlingstr. 17
|
||||
79100 Freiburg
|
||||
Germany
|
||||
<https://web.archive.org/web/20071018081145/http://pcpool.mathematik.uni-freiburg.de/~immi/>
|
||||
|
||||
@@ -14,12 +11,11 @@ make
|
||||
```
|
||||
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to work with
|
||||
clang by changing the args to main() to be `int` and `char **` respectively and
|
||||
changing specific references to the `argv` arg, casting to int which was its old
|
||||
type. However this entry only works completely if compiled as 32-bit (it does
|
||||
work in part if compiled as 64-bit). See the alternate code below for
|
||||
information on the 64-bit version and [bugs.md](/bugs.md) for more details on
|
||||
this issue in general. Thank you Cody for your assistance!
|
||||
both 64-bit and 32-bit compiles by changing most of the `int`s (all but that in
|
||||
`main`) to `long`s. He also fixed it to compile with clang by changing the args
|
||||
of main to be `int` and `char **` respectively and changing specific references
|
||||
to the `argv` arg, casting to `long` (was `int` but the 64-bit fix requires
|
||||
`long`) which was its old type. Thank you Cody for your assistance!
|
||||
|
||||
|
||||
## To run:
|
||||
@@ -28,20 +24,6 @@ this issue in general. Thank you Cody for your assistance!
|
||||
./herrmann2
|
||||
```
|
||||
|
||||
|
||||
### Alternate code:
|
||||
|
||||
As noted above an alternate version is available for 64-bit. This will crash in
|
||||
some of the invocations given by the author but it will work for the basic
|
||||
operations. To use try:
|
||||
|
||||
```sh
|
||||
make alt
|
||||
```
|
||||
|
||||
Use `herrmann2.alt` as you would `herrmann2` above and below.
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
char*d,A[9876];char*d,A[9876];char*d,A[9876];char*d,A[9876];char*d,A[9876];char
|
||||
e;b;*ad,a,c; te;b;*ad,a,c; te;*ad,a,c; w,te;*ad,a, w,te;*ad,and, w,te;*ad,
|
||||
r,T; wri; ;*h; r,T; wri; ;*h; r; wri; ;*h;_, r; wri;*h;_, r; wri;*har;_, r; wri
|
||||
;on;l;i(int V);on;l;i(int V);o;l;mai(int n,int V);o;mai(int n,int V);main(int n,char**V)
|
||||
;on;l;i(long V);on;l;i(long V);o;l;mai(long n,long V);o;mai(long n,long V);main(int n,char**V)
|
||||
{-!har ; {-!har ; {har =A; {h =A;ad =A;read
|
||||
(0,&e,o||n -- +(0,&e,o||n -- +(0,&o||n ,o-- +(0,&on ,o-4,- +(0,n ,o-=94,- +(0,n
|
||||
,l=b=8,!( te-*A,l=b=8,!( te-*A,l=b,!( time-*A,l=b, time)|-*A,l= time(0)|-*A,l=
|
||||
@@ -10,7 +10,7 @@ r,T; wri; ;*h; r,T; wri; ;*h; r; wri; ;*h;_, r; wri;*h;_, r; wri;*har;_, r; wri
|
||||
)=+ +95>e?(*& c)=+ +95>e?(*& c) +95>e?(*& _*c) +95>(*& _*c) +95>(*&r= _*c) +95>
|
||||
5,r+e-r +_:2-195,r+e-r +_:2-195+e-r +_:2-1<-95+e-r +_-1<-95+e-r ++?_-1<-95+e-r
|
||||
|(d==d),!n ?*d||(d==d),!n ?*d||(d==d),!n ?*d||(d==d),!n ?*d||(d==d),!n ?*d||(d=
|
||||
*( (char**)+(int)V+ *( (char)+(int)V+ *( (c),har)+V+ (c),har)+ (V+ (c),r)+ (V+ ( c),
|
||||
*( (char**)+(long)V+ *( (char)+(long)V+ *( (c),har)+V+ (c),har)+ (V+ (c),r)+ (V+ ( c),
|
||||
+0,*d-7 ) -r+8)+0,*d-7 -r+8)+0,*d-c:7 -r+80,*d-c:7 -r+7:80,*d-7 -r+7:80,*d++-7
|
||||
+7+! r: and%9- +7+! rand%9-85 +7+! rand%95 +7+!! rand%95 +7+ rand()%95 +7+ r
|
||||
-(r+o):(+w,_+ A-(r+o)+w,_+*( A-(r+o)+w,_+ A-(r=e+o)+w,_+ A-(r+o)+wri,_+ A-(r+o)
|
||||
|
||||
Reference in new issue
Block a user