TAILIEUCHUNG - THEORY AND PROBLEMS OF PROGRAMMING WITH Second Edition phần 9

Mặt khác, khai báo int (* p) (int a); cho thấy một con trỏ đến một chức năng mà chấp nhận một đối số số nguyên và Mục đích Quay trở lại giá trị tuyệt đối của tôi. Trả lại hồ quang cosin của d. Trả lại hồ quang sin của d. Trả lại hồ quang tiếp tuyến của d. Trả lại hồ quang tiếp tuyến của d l / d2. | 432 LOW-LEVEL PROGRAMMING CHAP. 13 A portion of a given bit pattern can be copied to a new word while the remainder of the original bit pattern is inverted within the new word. This type of masking operation makes use of bitwise exclusive or. The details are illustrated in the following example. EXAMPLE Suppose that a is an unsigned integer variable whose value is 0x6db7 as in the last several examples. Now let US reverse the rightmost 8 bits and preserve the leftmost 8 bits. This new bit pattern will be assigned to the unsigned integer variable b. To do this we make use of the bitwise exclusive or operation. b a A Oxff The hexadecimal constant Oxf f is the mask. This expression will result in the value 0x6d48 being assigned to b. Here are the corresponding bit patterns. a 0110 1101 1011 0111 mask 0000 0000 1111 1111 b 0110 1101 0100 1000 0x6d48 Remember that the bitwise operation is now bitwise exclusive or rather than bitwise and or bitwise or. Therefore when each of the rightmost 8 bits in a is compared with the corresponding 1 in the mask the resulting bit will be the opposite of die bit originally in a. On the other hand when each of the leftmost 8 bits in a is compared with the corresponding 0 in the mask the resulting bit will be the same as the bit originally in a. If we wanted to invert the leftmost 8 bits in a while preserving the original rightmost 8 bits we could write either b a OxffOO or the more desirable expression because it is independent of the word size b a A -Oxff The resulting value of each expression is 0x92b7. The exclusive or operation can be used repeatedly as a toggle to change the value of a particular bit within a word. In other words if a particular bit has a value of 1 the exclusive or operation will change its value to 0 and vice versa. Such operations are particularly common in programs that interact closely with the computer s hardware. EXAMPLE Suppose that a is an unsigned integer variable whose value is 0x6db7 as in .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.