cosmopolitan/third_party/unzip/crc32.h
Justine Tunney cf93ecbbb2 Prove that Makefile is fully defined
The whole repository is now buildable with GNU Make Landlock sandboxing.
This proves that no Makefile targets exist which touch files other than
their declared prerequisites. In order to do this, we had to:

  1. Stop code morphing GCC output in package.com and instead run a
     newly introduced FIXUPOBJ.COM command after GCC invocations.

  2. Disable all the crumby Python unit tests that do things like create
     files in the current directory, or rename() files between folders.
     This ended up being a lot of tests, but most of them are still ok.

  3. Introduce an .UNSANDBOXED variable to GNU Make to disable Landlock.
     We currently only do this for things like `make tags`.

  4. This change deletes some GNU Make code that was preventing the
     execve() optimization from working. This means it should no longer
     be necessary in most cases for command invocations to be indirected
     through the cocmd interpreter.

  5. Missing dependencies had to be declared in certain places, in cases
     where they couldn't be automatically determined by MKDEPS.COM

  6. The libcxx header situation has finally been tamed. One of the
     things that makes this difficult is MKDEPS.COM only wants to
     consider the first 64kb of a file, in order to go fast. But libcxx
     likes to have #include lines buried after huge documentation.

  7. An .UNVEIL variable has been introduced to GNU Make just in case
     we ever wish to explicitly specify additional things that need to
     be whitelisted which aren't strictly prerequisites. This works in
     a manner similar to the recently introduced .EXTRA_PREREQS feature.

There's now a new build/bootstrap/make.com prebuilt binary available. It
should no longer be possible to write invalid Makefile code.
2022-08-06 04:05:08 -07:00

66 lines
1.9 KiB
C

// clang-format off
/*
Copyright (c) 1990-2008 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
*/
/* crc32.h -- compute the CRC-32 of a data stream
* Copyright (C) 1995 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#ifndef __crc32_h
#define __crc32_h /* identifies this source module */
#include "third_party/unzip/unzip.h"
#include "third_party/unzip/unzip.h"
#include "third_party/unzip/unzpriv.h"
#include "third_party/zip/crc32.h"
#include "third_party/unzip/globals.h"
/* This header should be read AFTER zip.h resp. unzip.h
* (the latter with UNZIP_INTERNAL defined...).
*/
#ifndef OF
# define OF(a) a
#endif
#ifndef ZCONST
# define ZCONST const
#endif
#ifdef DYNALLOC_CRCTAB
void free_crc_table OF((void));
#endif
#ifndef USE_ZLIB
ZCONST ulg near *get_crc_table OF((void));
#endif
#if (defined(USE_ZLIB) || defined(CRC_TABLE_ONLY))
# ifdef IZ_CRC_BE_OPTIMIZ
# undef IZ_CRC_BE_OPTIMIZ
# endif
#else /* !(USE_ZLIB || CRC_TABLE_ONLY) */
ulg crc32 OF((ulg crc, ZCONST uch *buf, extent len));
#endif /* ?(USE_ZLIB || CRC_TABLE_ONLY) */
#ifndef CRC_32_TAB
# define CRC_32_TAB crc_32_tab
#endif
#ifdef CRC32
# undef CRC32
#endif
#ifdef IZ_CRC_BE_OPTIMIZ
# define CRC32UPD(c, crctab) (crctab[((c) >> 24)] ^ ((c) << 8))
# define CRC32(c, b, crctab) (crctab[(((int)(c) >> 24) ^ (b))] ^ ((c) << 8))
# define REV_BE(w) (((w)>>24)+(((w)>>8)&0xff00)+ \
(((w)&0xff00)<<8)+(((w)&0xff)<<24))
#else
# define CRC32UPD(c, crctab) (crctab[((int)(c)) & 0xff] ^ ((c) >> 8))
# define CRC32(c, b, crctab) (crctab[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8))
# define REV_BE(w) w
#endif
#endif /* !__crc32_h */