From 623d2f0dc01a6fad43bcb168e8b090ed586726b4 Mon Sep 17 00:00:00 2001 From: Roy Oursler Date: Thu, 17 Jan 2019 13:37:08 -0700 Subject: [PATCH] igzip: Bitbuf improvements Update Bitbuf to use stdmac and decrease register dependencies by replaces a sub with an and. Change-Id: Iaadf3c6ef7f533540a7adb57a418e9e80e9b8503 Signed-off-by: Roy Oursler --- igzip/bitbuf2.asm | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/igzip/bitbuf2.asm b/igzip/bitbuf2.asm index e263f98..7149382 100644 --- a/igzip/bitbuf2.asm +++ b/igzip/bitbuf2.asm @@ -28,6 +28,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; %include "options.asm" +%include "stdmac.asm" ; Assumes m_out_buf is a register ; Clobbers RCX @@ -40,12 +41,8 @@ %define %%count %4 %define %%m_out_buf %5 -%ifdef USE_HSWNI - shlx %%code, %%code, %%m_bit_count -%else - mov rcx, %%m_bit_count - shl %%code, cl -%endif + SHLX %%code, %%code, %%m_bit_count + or %%m_bits, %%code add %%m_bit_count, %%count @@ -54,12 +51,9 @@ shr rcx, 3 ; rcx = bytes add %%m_out_buf, rcx shl rcx, 3 ; rcx = bits - sub %%m_bit_count, rcx -%ifdef USE_HSWNI - shrx %%m_bits, %%m_bits, rcx -%else - shr %%m_bits, cl -%endif + and %%m_bit_count, 0x7 + + SHRX %%m_bits, %%m_bits, rcx %endm %macro write_dword 2