What's the difference? (Assembly)

This is a discussion on What's the difference? (Assembly) within the Tech Board forums, part of the Community Boards category; Code: xor edx,edx and Code: mov edx,0 ?...

  1. #1
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318

    What's the difference? (Assembly)

    Code:
    xor	edx,edx
    and
    Code:
    mov	edx,0
    ?
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    What does your processor manual tell you?
    My best code is written with the delete key.

  3. #3
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Speed.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Not speed. The two instructions take the same time, so the only speed difference can come from cache hits. Code size. The xor takes one byte, the mov two or more, not quite sure.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Messing with cache takes time, I guess.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  6. #6
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    There is little difference between them. Instruction size being the only noticeable diff as has been mentioned.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Learning Assembly
    By mrafcho001 in forum Tech Board
    Replies: 5
    Last Post: 03-12-2006, 05:00 PM
  2. assembly language...the best tool for game programming?
    By silk.odyssey in forum Game Programming
    Replies: 50
    Last Post: 06-22-2004, 02:11 PM
  3. Assembly
    By geek@02 in forum C++ Programming
    Replies: 1
    Last Post: 05-14-2004, 02:12 PM
  4. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 04:28 AM
  5. C,C++,Perl,Java
    By brusli in forum C Programming
    Replies: 9
    Last Post: 12-31-2001, 03:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21