© Jo Van Hoey 2019
J. Van HoeyBeginning x64 Assembly Programminghttps://doi.org/10.1007/978-1-4842-5076-1_9

9. Integer Arithmetic

Jo Van Hoey1 
(1)
Hamme, Belgium
 

In this chapter, you’ll see a number of arithmetic instructions for integers. Floating-point arithmetic will be covered in a later chapter. Now is a good time to quickly review Chapter 2 on binary numbers.

Starting with Integer Arithmetic

Listing 9-1 shows the example code we will analyze.
; icalc.asm
extern printf
section .data
      number1    dq    128   ; the numbers to be used to
      number2    dq    19    ; show the arithmetic
      neg_num    dq    -12   ; to show sign extension
      fmt        db    "The numbers are %ld and %ld",10,0
      fmtint     db    "%s %ld",10,0
      sumi  db   "The ...

Get Beginning x64 Assembly Programming: From Novice to AVX Professional now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.