Timeseal

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Richard Allbert
Posts: 792
Joined: Wed Jul 19, 2006 9:58 am

Timeseal

Post by Richard Allbert »

This could win stupid question of the year... but where do I get timeseal for the mac and for my raspberry pi??

The best I could turn up was here:

https://www.unix-ag.uni-kl.de/~chess/soft/timeseal/

But these are very old - and tbh I've no idea which is applicable.

Freechess.org say to use their ftp.freechess.org, but it doesn't seem to be active.

Where do people get it?

Thanks!
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Timeseal

Post by bob »

Richard Allbert wrote:This could win stupid question of the year... but where do I get timeseal for the mac and for my raspberry pi??

The best I could turn up was here:

https://www.unix-ag.uni-kl.de/~chess/soft/timeseal/

But these are very old - and tbh I've no idea which is applicable.

Freechess.org say to use their ftp.freechess.org, but it doesn't seem to be active.

Where do people get it?

Thanks!
Send me an email, I can send you one that will work on linux and one for OS X.
Richard Allbert
Posts: 792
Joined: Wed Jul 19, 2006 9:58 am

Re: Timeseal

Post by Richard Allbert »

Email sent, to the one on the https://www.cis.uab.edu/hyatt/ page.

Thanks so much!
brtzsnr
Posts: 433
Joined: Fri Jan 16, 2015 4:02 pm

Re: Timeseal

Post by brtzsnr »

I use this one to connect zurichess to fics http://www.bergo.eng.br/chess/openseal.c
Richard Allbert
Posts: 792
Joined: Wed Jul 19, 2006 9:58 am

Re: Timeseal

Post by Richard Allbert »

brtzsnr wrote:I use this one to connect zurichess to fics http://www.bergo.eng.br/chess/openseal.c
Thanks to you also :)

Thank goodness or forums...
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Timeseal

Post by Dann Corbit »

It's broken.

From the C-FAQ:

Code: Select all

3.3b:	Here's a slick expression:

		a ^= b ^= a ^= b

	It swaps a and b without using a temporary.

A:	Not portably, it doesn't.  It attempts to modify the variable a
	twice between sequence points, so its behavior is undefined.

	For example, it has been reported that when given the code

		int a = 123, b = 7654;
		a ^= b ^= a ^= b;

	the SCO Optimizing C compiler (icc) sets b to 123 and a to 0.

	See also questions 3.1, 3.8, 10.3, and 20.15c.
Notice:

Code: Select all

#define SC(A,B) s[B]^=s[A]^=s[B],s[A]^=s[B]
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
petero2
Posts: 688
Joined: Mon Apr 19, 2010 7:07 pm
Location: Sweden
Full name: Peter Osterlund

Re: Timeseal

Post by petero2 »

Dann Corbit wrote:It's broken.

From the C-FAQ:

Code: Select all

3.3b:	Here's a slick expression:

		a ^= b ^= a ^= b

	It swaps a and b without using a temporary.

A:	Not portably, it doesn't.  It attempts to modify the variable a
	twice between sequence points, so its behavior is undefined.

	For example, it has been reported that when given the code

		int a = 123, b = 7654;
		a ^= b ^= a ^= b;

	the SCO Optimizing C compiler (icc) sets b to 123 and a to 0.

	See also questions 3.1, 3.8, 10.3, and 20.15c.
Notice:

Code: Select all

#define SC(A,B) s[B]^=s[A]^=s[B],s[A]^=s[B]
I don't think that is broken, as long as you don't invoke the macro with A==B. Notice the comma in the #define. The comma operator introduces a sequence point.
mar
Posts: 2555
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Timeseal

Post by mar »

Dann Corbit wrote:

Code: Select all

#define SC(A,B) s[B]^=s[A]^=s[B],s[A]^=s[B]
I don't see the need to do xor-swap either, compilers will use a register anyway, so the only cool thing about xor-swap is that it obfuscates code.
Not to mention that this trick won't work with floats.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Timeseal

Post by Dann Corbit »

mar wrote:
Dann Corbit wrote:

Code: Select all

#define SC(A,B) s[B]^=s[A]^=s[B],s[A]^=s[B]
I don't see the need to do xor-swap either, compilers will use a register anyway, so the only cool thing about xor-swap is that it obfuscates code.
Not to mention that this trick won't work with floats.
As Peter points out, it is not (strictly speaking) illegal.

It is clear from the code that it is never called with A==B as the XOR inputs, so it probably also created correct results.

The fact that the macro is not typesafe also does not matter, since it is only used with integer arguments in the function.

But I am with you -- a simple swap using a temp would have been more clear and therefore better. It's not like we will produce wrong timing results if we lose 10 cycles.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
mar
Posts: 2555
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Timeseal

Post by mar »

Dann Corbit wrote:It is clear from the code that it is never called with A==B as the XOR inputs, so it probably also created correct results.
xor trick works even if A==B:

assume a=44, b=44:

Code: Select all

a ^= b (a = 0, b = 44)
b ^= a (a = 0, b = 44)
a ^= b (a = 44, b= 44)