Archive-Unzip-Burst

 view release on metacpan or  search on metacpan

unzip-6.0/human68k/crc_68.s  view on Meta::CPAN

;===========================================================================
; Copyright (c) 1990-2000 Info-ZIP.  All rights reserved.
;
; See the accompanying file LICENSE, version 2000-Apr-09 or later
; (the contents of which are also included in zip.h) for terms of use.
; If, for some reason, all these files are missing, the Info-ZIP license
; also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
;===========================================================================
; crc_68 created by Paul Kienitz, last modified 04 Jan 96.
;
; Return an updated 32 bit CRC value, given the old value and a block of data.
; The CRC table used to compute the value is gotten by calling get_crc_table().
; This replaces the older updcrc() function used in Zip and fUnZip.  The
; prototype of the function is:
;
;    ulg crc32(ulg crcval, uch *text, extent textlen);
;
; On the Amiga, type extent is always unsigned long, not unsigned int, because
; int can be short or long at whim, but size_t is long.
;
; If using this source on a non-Amiga 680x0 system, note that we treat
; a0/a1/d0/d1 as scratch registers not preserved across function calls.
; We do not bother to support registerized arguments for crc32() -- the
; textlen parm is usually large enough so that savings outside the loop
; are pointless.
;
; Define NO_UNROLLED_LOOPS to use a simple short loop which might be more
; efficient on certain machines with dinky instruction caches ('020?), or for
; processing short strings.  If loops are unrolled, the textlen parm must be
; less than 512K; if not unrolled, it must be less than 64K.
;
; 1999/09/23: for Human68k: Modified by Shimazaki Ryo.

        xdef    _crc32          ; (ulg val, uch *buf, extent bufsize)

DO_CRC0 MACRO
        moveq  #0,ltemp
        move.b (textbuf)+,ltemp
        eor.b  crcval,ltemp
        lsl.w  #2,ltemp
        move.l (crc_table,ltemp.w),ltemp
        lsr.l  #8,crcval
        eor.l  ltemp,crcval
        ENDM


DO_CRC2 MACRO
        move.b (textbuf)+,btemp
        eor.b  crcval,btemp
        lsr.l  #8,crcval
        move.l (crc_table,btemp.w*4),ltemp
        eor.l  ltemp,crcval
        ENDM

crc_table       reg     a0      array of unsigned long
crcval          reg     d0      unsigned long initial value
textbuf         reg     a1      array of unsigned char
textbufsize     reg     d1      unsigned long (count of bytes in textbuf)
btemp           reg     d2
ltemp           reg     d3


        xref    _get_crc_table  ; ulg *get_crc_table(void)



        quad
_crc32:
        move.l  8(sp),d0
        bne.s   valid
;;;;;   moveq  #0,d0



( run in 1.130 second using v1.01-cache-2.11-cpan-a49fcb8fa48 )