Hacker’s Delight Second Edition Henry S. Warren, Jr . Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid CapeTown • Sydney • Tokyo • Singapore • Mexico City To Joseph W. Gauld, my high school algebra teacher, for sparking in me a delight in the simple things in mathematics Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: U.S. Corporate and Government Sales (800) 382-3419 corpsales@pearsontechgroup.com For sales outside the United States, please contact: International Sales international@pearsoned.com Visit us on the Web: informit.com/aw Library of Congress Cataloging-in-Publication Data Warren, Henry S.     Hacker’s delight / Henry S. Warren, Jr. -- 2nd ed.               p. cm.     Includes bibliographical references and index.     ISBN 0-321-84268-5 (hardcover : alk. paper)     1. Computer programming. I. Title.     QA76.6.W375 2013     005.1—dc23 2012026011 Copyright © 2013 Pearson Education, Inc. All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission to use material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to (201) 236-3290. ISBN-13: 978-0-321-84268-8 ISBN-10:         0-321-84268-5 Text printed in the United States on recycled paper at Courier in Westford, Massachusetts. First printing, September 2012 Contents Foreword Preface CHAPTER 1. INTRODUCTION 1–1 Notation 1–2 Instruction Set and Execution Time Model CHAPTER 2. BASICS 2–1 Manipulating Rightmost Bits 2–2 Addition Combined with Logical Operations 2–3 Inequalities among Logical and Arithmetic Expressions 2–4 Absolute Value Function 2–5 Average of Two Integers 2–6 Sign Extension 2–7 Shift Right Signed from Unsigned 2–8 Sign Function 2–9 Three-Valued Compare Function 2–10 Transfer of Sign Function 2–11 Decoding a “Zero Means 2** n ” Field 2–12 Comparison Predicates 2–13 Overflow Detection 2–14 Condition Code Result of Add, Subtract, and Multiply 2–15 Rotate Shifts 2–16 Double-Length Add/Subtract 2–17 Double-Length Shifts 2–18 Multibyte Add, Subtract, Absolute Value 2–19 Doz, Max, Min 2–20 Exchanging Registers 2–21 Alternating among Two or More Values 2–22 A Boolean Decomposition Formula 2–23 Implementing Instructions for all 16 Binary Boolean Operations CHAPTER 3. P OWER-OF -2 BOUNDARIES 3–1 Rounding Up/Down to a Multiple of a Known Power of 2 3–2 Rounding Up/Down to the Next Power of 2 3–3 Detecting a Power-of-2 Boundary Crossing CHAPTER 4. ARITHMETIC BOUNDS 4–1 Checking Bounds of Integers 4–2 Propagating Bounds through Add ’s and Subtract’s 4–3 Propagating Bounds through Logical Operations CHAPTER 5. COUNTING BITS 5–1 5–2 5–3 5–4 Counting 1-Bits Parity Counting Leading 0’s Counting Trailing 0’s CHAPTER 6. S EARCHING WORDS 6–1 6–2 6–3 6–4 Find Find Find Find First 0-Byte First String of 1-Bits of a Given Length Longest String of 1-Bits Shortest String of 1-Bits CHAPTER 7. R EARRANGING BITS AND BYTES 7–1 7–2 7–3 7–4 7–5 7–6 7–7 7–8 7–9 Reversing Bits and Bytes Shuffling Bits Transposing a Bit Matrix Compress , or Generalized Extract Expand , or Generalized Insert Hardware Algorithms for Compress and Expand General Permutations, Sheep and Goats Operation Re

pdf文档 Hackers_Delight_2nd_Edition

计算机 > 其他 > other > 文档预览
470 页 0 下载 500 浏览 0 评论 0 收藏 3.0分
温馨提示:如果当前文档出现乱码或未能正常浏览,请先下载原文档进行浏览。
Hackers_Delight_2nd_Edition 第 1 页 Hackers_Delight_2nd_Edition 第 2 页 Hackers_Delight_2nd_Edition 第 3 页 Hackers_Delight_2nd_Edition 第 4 页 Hackers_Delight_2nd_Edition 第 5 页
下载文档到电脑,方便使用
还有 465 页可预览,继续阅读
本文档由 user2020-12-27 08:57:12上传分享
给文档打分
您好可以输入 255 个字符
DocHub文库的中文名是什么?( 答案:多哈 )
评论列表
  • 暂时还没有评论,期待您的金玉良言