Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: MS compiler issue [OT]

Author: Scott Gasch

Date: 22:33:08 10/15/05

Go up one level in this thread


Again, with FASTCALL on the function.  This is MS C++ .net 2003 I think.  I left
the comments in:

; Listing generated by Microsoft (R) Optimizing Compiler Version 13.10.3077

PUBLIC	@getDayIndex1March00@12
; Function compile flags: /Ogty
_TEXT	SEGMENT
_year$ = 8						; size = 4
@getDayIndex1March00@12 PROC NEAR
; _day$ = ecx
; _month$ = edx

; 637  : {

	push	ebx
	push	esi

; 638  :         static int daysTilMonth[12] =
; 639  :         {
; 640  :                 6*31 + 4*30, // jan
; 641  :                 7*31 + 4*30, // feb
; 642  :                 0*31 + 0*30, // mar
; 643  :                 1*31 + 0*30, // apr
; 644  :                 1*31 + 1*30, // may
; 645  :                 2*31 + 1*30, // jun
; 646  :                 2*31 + 2*30, // jul
; 647  :                 3*31 + 2*30, // aug
; 648  :                 4*31 + 2*30, // sep
; 649  :                 4*31 + 3*30, // oct
; 650  :                 5*31 + 3*30, // nov
; 651  :                 5*31 + 4*30, // dec
; 652  :         };
; 653  :         unsigned int cent, didx;
; 654  :         year -= (month < 3);

	mov	esi, DWORD PTR _year$[esp+4]
	push	edi
	mov	edi, edx
	cmp	edi, 3
	sbb	eax, eax
	neg	eax
	sub	esi, eax

; 655  :         cent  = year / 100;

	mov	eax, 1374389535				; 51eb851fH
	mul	esi

; 656  :         didx  = year * 365 + (year>>2) - cent + (cent>>2)
; 657  :                   + daysTilMonth[month-1] + day;

	lea	eax, DWORD PTR [esi+esi*8]
	lea	eax, DWORD PTR [esi+eax*8]
	lea	ebx, DWORD PTR [eax+eax*4]

; 658  :         return didx;

	mov	eax, DWORD PTR ?daysTilMonth@?1??getDayIndex1March00@@9@9[edi*4-4]
	shr	edx, 5
	add	eax, ebx
	mov	edi, edx
	shr	edi, 2
	add	eax, edi
	shr	esi, 2
	add	eax, esi
	pop	edi
	sub	eax, edx
	pop	esi
	add	eax, ecx
	pop	ebx

; 659  : }

	ret	4
@getDayIndex1March00@12 ENDP
_TEXT	ENDS
END



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.