Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Is < 0 faster than == -1?

Name: Anonymous 2011-07-13 14:00

If checking some kind of return value, isn't the first one faster since some flag will be set already so you don't have to do an extra comparison?

Name: Anonymous 2011-07-13 14:05

Assuming that eax holds the value,
compare
or eax,eax
and
cmp eax,-1

they both execute in one cycle

Name: Anonymous 2011-07-13 14:17

>>2
Isn't the flag already set when the value is assigned to the register?  I guess it must be assumed that nothing else overwrites the flag, could the x86 ABIs have some sort of guarantee for this?

Name: Anonymous 2011-07-13 14:54

>>3
mov doesn't touch eflags, rtfm

Name: Anonymous 2011-07-13 15:08

test eax, eax

Name: Anonymous 2011-07-13 16:03

It sure is premature optimization in here.

Name: VIPPER 2011-07-13 16:07

When did OP say it was on X86?

Name: Anonymous 2011-07-13 16:41

>>4
Flags Affected
None.

FFFFUUUUUUUUUU----

Flags Affected: n - - - - - z -
                n Set if most significant bit of loaded value is set; else cleared.
                z Set if value loaded is zero; else cleared.

At least on the 6502 it does ;_;

Name: Anonymous 2011-07-13 16:47

>>8
props for knowing 6502, bro

Name: Anonymous 2011-07-13 16:47

>>8
>FFFFUUUUUUUUUU----
Back to the [m]boards[m] subdomain, HeTeRosexual peasant!!

Name: Anonymous 2011-07-13 16:51

>>10
quoting failure (in the style of the image boards)
bbcode failure
Your anus is showing.  I am staring suggestively.

Name: Anonymous 2011-07-13 17:00

>>11
Who are
you quoting?

Name: Anonymous 2011-07-13 17:04

>>12
I am not quoting anyone, I am performing an act commonly known as ``greentexting.''[1]

___
[1] http://dis.4chan.org/read/img/1158033654

Name: Anonymous 2011-07-13 17:16

>>13
Greentexting is PROHIBITED in /prog/.

Name: Anonymous 2011-07-13 17:27

>>14
only if you're an autistic faggot like yourself

Name: Anonymous 2011-07-13 17:38

Name: Anonymous 2011-07-13 17:41

>>16
`>implying you can't greentext on the textboards

Name: Anonymous 2011-07-13 18:01

Implying
Back to /b/ please.

Name: Anonymous 2011-07-13 18:15

this reeks of premature optimization.

Hint: it's totally and utterly irrelevant.

Name: Anonymous 2011-07-13 18:32

>>19
Prematurely optimize my anus!

Name: Anonymous 2011-07-13 19:35

>>2
One is 2 bytes, the other is either 3 or 5 depending on how smart the assembler is. In any case, avoid using immediate values in instructions as it can cause an extra cycle under certain conditions. Maybe not noticeable these days with CPUs that gulp down 16+ bytes in a single fetch, but still good to keep in mind.

>>4,8
And for good reason too. The compiler and CPU can reorder data movement instructions around conditional jumps, with the latter possibly executing in parallel with a jump.

Name: Anonymous 2011-07-13 22:50

ASS-emblers are not SMART like CUM-pilers

Name: Anonymous 2011-07-13 23:46

13 July 2011

   The US Government is due to establish a Federal Programming Administration (FPA) over the next few weeks. During this time, government officials will be screening individuals for administrative positions and will be laying the groundwork for guidelines which all software companies will soon be required to follow.
   Under these guidelines, all computer code will be required to meet a level of quality. "Obviously, there is a lot of code in the market already," explains government technical expert Ryan Jennings. "Thus, the FPA will only screen software by a complaint-by-complaint basis." Jennings goes on to describe a couple of the guidelines. "In the future, programs will have to start up in less than a couple of seconds. The programs themselves have to be programmed in one of the many enterprise languages which are widespread in use, such as Java, VB.NET, and PHP. Remember, a positive user experience is everything here and the FPA will ensure that it happens."
   US Congress is due to pass a set of laws in the future which will halt the distribution of computer software deemed "low-quality" by the FPA. According to Jennings, "The goal here is to lower and eventually eliminate the already high amount of poor quality software. Top issues in the agenda include the elimination of functional programming, a sub-par programming practice, and particularly open-source software. Open-source software is seen as destructive to the economy so we already have plans to ban its production." The screening process is estimated to be completed in a few days. "It's only a matter of time, but I'm certain this is going to work out. I really see a bright future in the computer industry."

Name: Anonymous 2011-07-13 23:52

>>23
holy shit

Name: Anonymous 2011-07-14 0:01

>>23
Sure, the US government rules the whole world. Go back to the imageboards.

Name: Anonymous 2011-07-14 0:21

>>25
Ever heard of ICE?

Name: Anonymous 2011-07-14 0:29

>>26
[citation still needed]

Name: Anonymous 2011-07-14 3:42

>>23
did you just make that shit up?

Name: Anonymous 2011-07-14 7:22

>>28
Yes.

Name: Anonymous 2011-07-14 8:20

Using < is convenient in for loops because it allows you to change the stepping.
<code>
for(i=0;i<10;i+=3); still works.
</code>

Name: Anonymous 2011-07-14 8:30

>>30
Back to SDZ or whatever retarded website uses an XML-like language for posts presentation. Also, relying upon integer overflows is retarded.

Name: Anonymous 2011-07-14 9:48

>>31
"overflows", lol

Name: Anonymous 2011-07-14 10:21

>>31
Integers on your machine only go up to 10?

Name: Anonymous 2011-07-14 10:33

>>8
FFFFUUUUUUUUUU----
back to /r/f7u12, please

Name: Anonymous 2011-07-14 10:47

>>33
Yes.

Name: Anonymous 2011-07-14 13:28

>>35
AMD fag detected.

Name: Anonymous 2011-07-14 16:54

>>36
back to /gay/

Name: Anonymous 2011-07-14 17:52

>>34
back to proggit, onegai shimasu

Don't change these.
Name: Email:
Entire Thread Thread List