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

16. Bit Operations

Jo Van Hoey1 
(1)
Hamme, Belgium
 

We have already done bit operations in Chapter 9 on integer arithmetic: shift arithmetic sar and sal are bit operations, shifting bits right or left. Also, the and instruction for aligning the stack covered in the previous chapter is a bit operation.

Basics

In the following example program, we are building a custom C function called printb to print a string of bits. For convenience, it separates the string of 64 bits into 8 bytes, with 8 bits each. As an exercise, after you finish this chapter, take a look at the C code, and you should be able to write an assembler program to build a string ...

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.