OP_SRL_KR

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
dpJudas
 
 
Posts: 3040
Joined: Sat May 28, 2016 1:01 pm

OP_SRL_KR

Post by dpJudas »

While looking at some of the VM code I came across something I thinks looks like a bug, but would like to get that confirmed.

Notice the difference between OP_SLL_KR, SRL_KR and SRA_KR:

Code: Select all

	OP(SLL_KR):
		ASSERTD(a); ASSERTKD(B); ASSERTD(C);
		reg.d[a] = konstd[B] << reg.d[C];
		NEXTOP;

	OP(SRL_KR):
		ASSERTD(a); ASSERTKD(B); ASSERTD(C);
		reg.d[a] = (unsigned)konstd[B] >> C;
		NEXTOP;

	OP(SRA_KR):
		ASSERTD(a); ASSERTKD(B); ASSERTD(C);
		reg.d[a] = konstd[B] >> reg.d[C];
		NEXTOP;
Shouldn't it be reg.d for SRL_KR as well? It makes no sense to have an opcode that just assigns a compile time constant.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: OP_SRL_KR

Post by _mental_ »

Yes, it looks like a copy/paste from opcode with immediate operand.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: OP_SRL_KR

Post by Graf Zahl »

This never caused problems with scripts misbehaving??? :?
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: OP_SRL_KR

Post by Major Cooke »

I wonder what that represents in particular?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: OP_SRL_KR

Post by Graf Zahl »

This opcode is for shifting an unsigned constant to the right by an amount of bits specified by a variable.

In DECORATE terms something like "1337 >>> b", which is admittedly something that's not being used frequently.
Post Reply

Return to “Closed Bugs [GZDoom]”