FASM 32-bit to 28-bit algorithm: remove each byte (bit 7)

Source: Internet
Author: User

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>; * -- = -- * You are given a 32 bit value where the most significant; * -- = -- * bit in each byte (bit 7) must be ignored, thus encoding; * -- = -- * a 28 bit value. write an optimal function to decode the; * -- = -- * value (strip the ignored bits ).; * -- = -- * by G-spider; * -- = -- * FASM mttest. ASM mttest.exe; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> format PE consoleentry startinclude 'win32a. INC '; --------------------------------------------- section '. text 'Code readable executable start: stdcall _ uint32touint28, 0f7abh cinvoke printf, szfmt, eax cinvoke system, szpause RET align tags: mov eax, DWORD [esp + 4] and eax, 7f7f7f7fh movzx ECx, ax SHR eax, 16 movzx ECx, word [LUT + ECx * 2] movzx eax, word [LUT + eax * 2] SHL eax, 14 or eax, ecx ret 4; ----------------------------------------------- section '. data 'data readable writeablelut: Repeat 32768 DW (%-1) and 0x7f00) SHR 1) or (%-1) and 0x7f) end repeatszfmt dB '% x ', 0ah, 00 hszpause dB 'pause', 0; ----------------------------------------------- section '. idata 'import data readable writeable library msvcrt, 'msvcrt. DLL 'import msvcrt, \ printf, 'printf', \ System, 'system'

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.