mirror of
https://github.com/libAthena/athena.git
synced 2025-12-08 13:15:05 +00:00
Compare commits
162 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a411b1084c | |||
| 7c4d0bb6fd | |||
| 9e7733eb02 | |||
|
|
f46edcd4b8 | ||
|
|
21724766ba | ||
| 1601abcc7a | |||
|
|
e861691480 | ||
|
|
7f5abb6849 | ||
|
|
8221d6e25a | ||
| 8124d219d9 | |||
| 1b67cce607 | |||
| b9d79a9581 | |||
| 1ee7c82d8b | |||
| 8e8135370e | |||
| 1c0c44938e | |||
| 340588db62 | |||
|
|
ffca1f1897 | ||
| 25de226e65 | |||
|
|
a753c2e38a | ||
|
|
069840a77e | ||
|
|
418f3e763f | ||
|
|
e6dedd0e6c | ||
|
|
f4716070dd | ||
|
|
a999744ab6 | ||
|
|
4eae909848 | ||
| 3d90c14795 | |||
| 0762a3bdcc | |||
|
|
574038a826 | ||
|
|
9535778932 | ||
|
|
89fa92308f | ||
| 1e1adeb2fb | |||
| c241158c7b | |||
| 4c7280e024 | |||
|
|
4ffce2dbc3 | ||
|
|
a16fd79838 | ||
|
|
4a4962424d | ||
|
|
bca146dbfc | ||
|
|
9c44d5f4de | ||
| 0de254e846 | |||
|
|
e52e9f8dc4 | ||
|
|
9b6fea36e3 | ||
| 1de67f30b8 | |||
|
|
4d13caeaab | ||
|
|
66cb6c982e | ||
|
|
92898661cc | ||
|
|
a145f337c0 | ||
|
|
b664c7df8f | ||
|
|
9655cb41d1 | ||
| 7464c8e5eb | |||
|
|
d9b7151487 | ||
|
|
776d52e4e5 | ||
|
|
13d545c3fd | ||
|
|
dac1dde468 | ||
|
|
f49a6a6e82 | ||
|
|
2e240520e1 | ||
|
|
9f0cb1327b | ||
|
|
9ed090b126 | ||
|
|
02e7bb3fc6 | ||
|
|
f06afb429c | ||
|
|
3d220841c0 | ||
|
|
7a90a0f6d0 | ||
|
|
3edc800e10 | ||
|
|
84591d4260 | ||
|
|
43c317529c | ||
|
|
b38d7533c5 | ||
|
|
b7d4c51979 | ||
|
|
ac36bb4f4a | ||
|
|
8e5e4d7603 | ||
| d9c4d3b79b | |||
| 8ea5071e0f | |||
|
|
602f6b6e15 | ||
|
|
78286b0f67 | ||
|
|
c6a6d3b9c4 | ||
|
|
6405bffdd2 | ||
|
|
7442d618e7 | ||
|
|
f3ba8819a4 | ||
|
|
24fedff58e | ||
|
|
87306a18d8 | ||
|
|
09e3d33ff2 | ||
|
|
11331e068e | ||
|
|
7ec5a5971a | ||
|
|
7ef451c86a | ||
|
|
ece50c6968 | ||
| 4bc6004a6a | |||
|
|
55adeec69c | ||
| 4f8df65a3d | |||
| 8d3524b1f6 | |||
| a7c180db00 | |||
|
|
a19dcad876 | ||
|
|
3ce2062686 | ||
|
|
f874dfff31 | ||
|
|
e45679ffba | ||
|
|
1e55ce5138 | ||
|
|
35a5736c35 | ||
|
|
b7ba46b995 | ||
|
|
c65ef591f5 | ||
|
|
1b40613c05 | ||
|
|
dde7164651 | ||
|
|
916515f0d7 | ||
|
|
e1f46b824f | ||
|
|
c49ec5c13d | ||
|
|
8ca702785c | ||
|
|
44e25e09ca | ||
|
|
ec38ba088e | ||
|
|
108a3aa6c1 | ||
|
|
8a397a1622 | ||
|
|
97dfabb265 | ||
|
|
ce917d4aca | ||
|
|
6ac88b37f4 | ||
|
|
a63da8db2f | ||
|
|
2b37765eff | ||
|
|
fa016115c2 | ||
| a76a3c584a | |||
|
|
bfa08ce52b | ||
|
|
7524b1f063 | ||
|
|
49937cba50 | ||
|
|
3ff34ec749 | ||
|
|
0bb90ff2e0 | ||
|
|
071d91a671 | ||
|
|
490c6d53f5 | ||
|
|
a0f0690719 | ||
|
|
5a0f2e8ed4 | ||
|
|
687a7eef64 | ||
|
|
2d8aeb70e8 | ||
|
|
e641dbbe4b | ||
|
|
3dfb001f3d | ||
|
|
242a06915b | ||
|
|
fd3db3e1db | ||
|
|
7b1b027192 | ||
|
|
7cdfcab55a | ||
|
|
1aa3a705af | ||
|
|
d6a489753d | ||
|
|
c08695709e | ||
|
|
6c7f5ebd29 | ||
|
|
2c63768ec4 | ||
|
|
791a355ace | ||
|
|
9ebdb37b85 | ||
|
|
3071db8f61 | ||
|
|
0bf9815fc0 | ||
|
|
647f9c4dec | ||
|
|
ec4ac688f4 | ||
|
|
7fccd416f3 | ||
|
|
b195c194f7 | ||
|
|
96ed8a2ce2 | ||
|
|
2bb60ab152 | ||
|
|
fb722a9f5b | ||
|
|
775b51fd00 | ||
|
|
0452e34150 | ||
|
|
c09f06b436 | ||
|
|
dde8ac1a1c | ||
| 1ea07c20fb | |||
| 7785983093 | |||
| 6a611ef2cc | |||
| d5ccf159f7 | |||
|
|
3223d3faa6 | ||
|
|
92d86a2673 | ||
| 47dafe3251 | |||
| 011496db8b | |||
| 29a203522d | |||
| 6ee11b9a08 | |||
| 423a9a37d2 | |||
| 01f989c21c |
17
.travis.yml
17
.travis.yml
@@ -1,17 +0,0 @@
|
||||
compiler:
|
||||
- gcc-4.8
|
||||
|
||||
before_install:
|
||||
- sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa
|
||||
- sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq g++-4.8
|
||||
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
|
||||
- sudo update-alternatives --config gcc
|
||||
|
||||
script:
|
||||
- qmake Athena.pro
|
||||
- make
|
||||
|
||||
notifications:
|
||||
irc: "irc.wiiking2.com#wiiking2"
|
||||
BIN
Athena.icns
Normal file
BIN
Athena.icns
Normal file
Binary file not shown.
BIN
Athena.ico
Normal file
BIN
Athena.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 90 KiB |
@@ -1,4 +0,0 @@
|
||||
include(AthenaCore.pri)
|
||||
include(AthenaZelda.pri)
|
||||
include(AthenaWiiSave.pri)
|
||||
include(AthenaSakura.pri)
|
||||
63
Athena.pro
63
Athena.pro
@@ -1,63 +0,0 @@
|
||||
CONFIG += staticlib c++11
|
||||
QMAKE_CXXFLAGS += -std=c++11
|
||||
TEMPLATE= lib
|
||||
DESTDIR = ./lib
|
||||
INCLUDEPATH += $$PWD/include
|
||||
|
||||
# Uncomment this if you wish to use Qt with libAthena
|
||||
#DEFINES += ATHENA_USE_QT
|
||||
|
||||
contains(DEFINES, ATHENA_USE_QT){
|
||||
QT += qt core
|
||||
} else {
|
||||
QT =
|
||||
}
|
||||
|
||||
CONFIG(debug, debug|release): {
|
||||
DEFINES += DEBUG
|
||||
TARGET=Athena-d
|
||||
# We don't want the objects,
|
||||
# in the project directory, so tell qmake
|
||||
# where to put them
|
||||
OBJECTS_DIR = obj/debug
|
||||
}
|
||||
|
||||
CONFIG(release, release|debug): {
|
||||
DEFINES -= DEBUG
|
||||
TARGET=Athena
|
||||
# We don't want the objects,
|
||||
# in the project directory, so tell qmake
|
||||
# where to put them
|
||||
OBJECTS_DIR = obj/release
|
||||
}
|
||||
|
||||
ATHENA_PRO=true
|
||||
|
||||
include(Athena.pri)
|
||||
|
||||
|
||||
OTHER_FILES += \
|
||||
.travis.yml
|
||||
|
||||
unix {
|
||||
isEmpty(PREFIX) {
|
||||
PREFIX = /usr/local
|
||||
}
|
||||
libFiles.path = $$PREFIX/lib
|
||||
libFiles.files = $$PWD/lib/*
|
||||
headerFiles.files = $$PWD/include/*
|
||||
headerFiles.path = $$PREFIX/include/Athena
|
||||
INSTALLS += libFiles headerFiles
|
||||
}
|
||||
|
||||
win32 {
|
||||
isEmpty(PREFIX) {
|
||||
PREFIX = $$PWD/pkg
|
||||
}
|
||||
|
||||
libFiles.path = $$PREFIX/lib
|
||||
libFiles.files = $$PWD/lib/*
|
||||
headerFiles.path = $$PREFIX/include/Athena
|
||||
headerFiles.files = $$PWD/include/*
|
||||
INSTALLS += libFiles headerFiles
|
||||
}
|
||||
22
AthenaConfig.cmake.in
Normal file
22
AthenaConfig.cmake.in
Normal file
@@ -0,0 +1,22 @@
|
||||
# - Config file for the Athena package
|
||||
# It defines the following variables
|
||||
# ATHENA_INCLUDE_DIR - include directory for Athena
|
||||
# ATHENA_LIBRARIES - libraries to link against
|
||||
# ATHENA_ICON - path to Athena.ico
|
||||
|
||||
# Compute paths
|
||||
get_filename_component(ATHENA_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
set(ATHENA_INCLUDE_DIR "@CONF_INCLUDE_DIR@")
|
||||
|
||||
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||
if(NOT TARGET AthenaCore AND NOT Athena_BINARY_DIR)
|
||||
include("${ATHENA_CMAKE_DIR}/AthenaTargets.cmake")
|
||||
endif()
|
||||
|
||||
# These are IMPORTED targets created by AthenaTargets.cmake
|
||||
set(ATHENA_LIBRARIES AthenaCore AthenaSakura AthenaZelda AthenaWiiSave)
|
||||
|
||||
# Set icon location if on windows
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
set(ATHENA_ICON "@CONF_ICON_DIR@")
|
||||
endif()
|
||||
11
AthenaConfigVersion.cmake.in
Normal file
11
AthenaConfigVersion.cmake.in
Normal file
@@ -0,0 +1,11 @@
|
||||
set(PACKAGE_VERSION "@ATHENA_VERSION@")
|
||||
|
||||
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,66 +0,0 @@
|
||||
!contains(ATHENA_PRO, true): {
|
||||
INCLUDEPATH += $$PWD/include
|
||||
!contains(CONFIG, c++11):CONFIG += c++11
|
||||
mac:QMAKE_CXXFLAGS += -stdlib=libc++
|
||||
}
|
||||
|
||||
include(extern/lzo/lzo.pri)
|
||||
include(extern/zlib/zlib.pri)
|
||||
|
||||
ATHENA_CORE=true
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/src/Athena/Utility.cpp \
|
||||
$$PWD/src/Athena/FileReader.cpp \
|
||||
$$PWD/src/Athena/FileWriter.cpp \
|
||||
$$PWD/src/Athena/MemoryReader.cpp \
|
||||
$$PWD/src/Athena/MemoryWriter.cpp \
|
||||
$$PWD/src/Athena/Global.cpp \
|
||||
$$PWD/src/Athena/Checksums.cpp \
|
||||
$$PWD/src/Athena/Compression.cpp \
|
||||
$$PWD/src/LZ77/LZLookupTable.cpp \
|
||||
$$PWD/src/LZ77/LZType10.cpp \
|
||||
$$PWD/src/LZ77/LZType11.cpp \
|
||||
$$PWD/src/LZ77/LZBase.cpp
|
||||
|
||||
win32:SOURCES += \
|
||||
$$PWD/src/win32_largefilewrapper.c
|
||||
|
||||
mac:SOURCES += \
|
||||
$$PWD/src/osx_largefilewrapper.c
|
||||
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/include/Athena/IStream.hpp \
|
||||
$$PWD/include/Athena/IStreamReader.hpp \
|
||||
$$PWD/include/Athena/IStreamWriter.hpp \
|
||||
$$PWD/include/Athena/Types.hpp \
|
||||
$$PWD/include/Athena/Utility.hpp \
|
||||
$$PWD/include/Athena/Global.hpp \
|
||||
$$PWD/include/Athena/Exception.hpp \
|
||||
$$PWD/include/Athena/FileNotFoundException.hpp \
|
||||
$$PWD/include/Athena/IOException.hpp \
|
||||
$$PWD/include/Athena/InvalidDataException.hpp \
|
||||
$$PWD/include/Athena/InvalidOperationException.hpp \
|
||||
$$PWD/include/Athena/FileReader.hpp \
|
||||
$$PWD/include/Athena/FileWriter.hpp \
|
||||
$$PWD/include/Athena/MemoryReader.hpp \
|
||||
$$PWD/include/Athena/MemoryWriter.hpp \
|
||||
$$PWD/include/Athena/NotImplementedException.hpp \
|
||||
$$PWD/include/Athena/Checksums.hpp \
|
||||
$$PWD/include/Athena/Compression.hpp \
|
||||
$$PWD/include/LZ77/LZBase.hpp \
|
||||
$$PWD/include/LZ77/LZLookupTable.hpp \
|
||||
$$PWD/include/LZ77/LZType10.hpp \
|
||||
$$PWD/include/LZ77/LZType11.hpp \
|
||||
$$PWD/include/utf8.h \
|
||||
$$PWD/include/utf8/checked.h \
|
||||
$$PWD/include/utf8/core.h \
|
||||
$$PWD/include/utf8/unchecked.h
|
||||
|
||||
win32:HEADERS += \
|
||||
$$PWD/include/win32_largefilewrapper.h
|
||||
|
||||
mac:HEADERS += \
|
||||
$$PWD/include/osx_largefilewrapper.h
|
||||
|
||||
BIN
AthenaNSIS.bmp
Normal file
BIN
AthenaNSIS.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
@@ -1,20 +0,0 @@
|
||||
!contains(ATHENA_CORE, true): {
|
||||
message("including core")
|
||||
include(AthenaCore.pri)
|
||||
}
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/src/Athena/Sprite.cpp \
|
||||
$$PWD/src/Athena/SpriteFile.cpp \
|
||||
$$PWD/src/Athena/SpriteFileReader.cpp \
|
||||
$$PWD/src/Athena/SpriteFileWriter.cpp \
|
||||
$$PWD/src/Athena/SpriteFrame.cpp \
|
||||
$$PWD/src/Athena/SpritePart.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/include/Athena/Sprite.hpp \
|
||||
$$PWD/include/Athena/SpriteFile.hpp \
|
||||
$$PWD/include/Athena/SpriteFileReader.hpp \
|
||||
$$PWD/include/Athena/SpriteFileWriter.hpp \
|
||||
$$PWD/include/Athena/SpriteFrame.hpp \
|
||||
$$PWD/include/Athena/SpritePart.hpp
|
||||
@@ -1,30 +0,0 @@
|
||||
!contains(ATHENA_CORE, true): {
|
||||
message("including core")
|
||||
include(AthenaCore.pri)
|
||||
}
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/src/Athena/WiiBanner.cpp \
|
||||
$$PWD/src/Athena/WiiFile.cpp \
|
||||
$$PWD/src/Athena/WiiImage.cpp \
|
||||
$$PWD/src/Athena/WiiSave.cpp \
|
||||
$$PWD/src/Athena/WiiSaveReader.cpp \
|
||||
$$PWD/src/Athena/WiiSaveWriter.cpp \
|
||||
$$PWD/src/bn.cpp \
|
||||
$$PWD/src/ec.cpp \
|
||||
$$PWD/src/md5.cpp \
|
||||
$$PWD/src/sha1.cpp \
|
||||
$$PWD/src/aes.c
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/include/Athena/WiiBanner.hpp \
|
||||
$$PWD/include/Athena/WiiFile.hpp \
|
||||
$$PWD/include/Athena/WiiImage.hpp \
|
||||
$$PWD/include/Athena/WiiSave.hpp \
|
||||
$$PWD/include/Athena/WiiSaveReader.hpp \
|
||||
$$PWD/include/Athena/WiiSaveWriter.hpp \
|
||||
$$PWD/include/aes.h \
|
||||
$$PWD/include/bn.h \
|
||||
$$PWD/include/ec.h \
|
||||
$$PWD/include/md5.h \
|
||||
$$PWD/include/sha1.h
|
||||
@@ -1,36 +0,0 @@
|
||||
!contains(ATHENA_CORE, true): {
|
||||
message("including core")
|
||||
include(AthenaCore.pri)
|
||||
}
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/src/Athena/ALTTPFile.cpp \
|
||||
$$PWD/src/Athena/ALTTPFileReader.cpp \
|
||||
$$PWD/src/Athena/ALTTPFileWriter.cpp \
|
||||
$$PWD/src/Athena/ALTTPQuest.cpp \
|
||||
$$PWD/src/Athena/MCFile.cpp \
|
||||
$$PWD/src/Athena/MCFileReader.cpp \
|
||||
$$PWD/src/Athena/MCFileWriter.cpp \
|
||||
$$PWD/src/Athena/MCSlot.cpp \
|
||||
$$PWD/src/Athena/SkywardSwordFile.cpp \
|
||||
$$PWD/src/Athena/SkywardSwordFileReader.cpp \
|
||||
$$PWD/src/Athena/SkywardSwordFileWriter.cpp \
|
||||
$$PWD/src/Athena/SkywardSwordQuest.cpp \
|
||||
$$PWD/src/Athena/ZQuestFile.cpp \
|
||||
$$PWD/src/Athena/ZQuestFileReader.cpp \
|
||||
$$PWD/src/Athena/ZQuestFileWriter.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/include/Athena/ALTTPEnums.hpp \
|
||||
$$PWD/include/Athena/ALTTPFile.hpp \
|
||||
$$PWD/include/Athena/ALTTPFileReader.hpp \
|
||||
$$PWD/include/Athena/ALTTPFileWriter.hpp \
|
||||
$$PWD/include/Athena/ALTTPQuest.hpp \
|
||||
$$PWD/include/Athena/ALTTPStructs.hpp \
|
||||
$$PWD/include/Athena/MCFile.hpp \
|
||||
$$PWD/include/Athena/MCFileReader.hpp \
|
||||
$$PWD/include/Athena/MCFileWriter.hpp \
|
||||
$$PWD/include/Athena/SkywardSwordFile.hpp \
|
||||
$$PWD/include/Athena/SkywardSwordFileReader.hpp \
|
||||
$$PWD/include/Athena/SkywardSwordFileWriter.hpp \
|
||||
$$PWD/include/Athena/SkywardSwordQuest.hpp
|
||||
272
CMakeLists.txt
Normal file
272
CMakeLists.txt
Normal file
@@ -0,0 +1,272 @@
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(Athena)
|
||||
endif()
|
||||
|
||||
##################
|
||||
# Athena Version #
|
||||
##################
|
||||
|
||||
set(ATHENA_MAJOR_VERSION 2)
|
||||
set(ATHENA_MINOR_VERSION 3)
|
||||
set(ATHENA_PATCH_VERSION 0)
|
||||
set(ATHENA_VERSION
|
||||
${ATHENA_MAJOR_VERSION}.${ATHENA_MINOR_VERSION}.${ATHENA_PATCH_VERSION})
|
||||
|
||||
################
|
||||
# Athena Build #
|
||||
################
|
||||
|
||||
add_subdirectory(extern)
|
||||
|
||||
include_directories(include ${LZO_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
|
||||
if (NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND CORE_EXTRA src/win32_largefilewrapper.c include/win32_largefilewrapper.h)
|
||||
elseif(APPLE OR GEKKO)
|
||||
list(APPEND CORE_EXTRA src/osx_largefilewrapper.c include/osx_largefilewrapper.h)
|
||||
if(GEKKO)
|
||||
list(APPEND CORE_EXTRA src/gekko_support.c include/gekko_support.h)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(AthenaCore
|
||||
src/Athena/Utility.cpp
|
||||
src/Athena/FileReader.cpp
|
||||
src/Athena/FileWriter.cpp
|
||||
src/Athena/MemoryReader.cpp
|
||||
src/Athena/MemoryWriter.cpp
|
||||
src/Athena/Global.cpp
|
||||
src/Athena/Checksums.cpp
|
||||
src/Athena/Compression.cpp
|
||||
src/LZ77/LZLookupTable.cpp
|
||||
src/LZ77/LZType10.cpp
|
||||
src/LZ77/LZType11.cpp
|
||||
src/LZ77/LZBase.cpp
|
||||
src/Athena/FileInfo.cpp
|
||||
src/Athena/Dir.cpp
|
||||
src/Athena/DNAYaml.cpp
|
||||
${CORE_EXTRA}
|
||||
|
||||
include/Athena/IStream.hpp
|
||||
include/Athena/IStreamReader.hpp
|
||||
include/Athena/IStreamWriter.hpp
|
||||
include/Athena/Types.hpp
|
||||
include/Athena/Utility.hpp
|
||||
include/Athena/Global.hpp
|
||||
include/Athena/FileReader.hpp
|
||||
include/Athena/FileWriter.hpp
|
||||
include/Athena/MemoryReader.hpp
|
||||
include/Athena/MemoryWriter.hpp
|
||||
include/Athena/Checksums.hpp
|
||||
include/Athena/Compression.hpp
|
||||
include/LZ77/LZBase.hpp
|
||||
include/LZ77/LZLookupTable.hpp
|
||||
include/LZ77/LZType10.hpp
|
||||
include/LZ77/LZType11.hpp
|
||||
include/Athena/FileInfo.hpp
|
||||
include/Athena/Dir.hpp
|
||||
include/Athena/DNA.hpp
|
||||
include/Athena/DNAYaml.hpp
|
||||
include/yaml.h
|
||||
include/utf8proc.h
|
||||
)
|
||||
|
||||
add_library(AthenaSakura EXCLUDE_FROM_ALL
|
||||
src/Athena/Sprite.cpp
|
||||
src/Athena/SpriteFile.cpp
|
||||
src/Athena/SpriteFileReader.cpp
|
||||
src/Athena/SpriteFileWriter.cpp
|
||||
src/Athena/SpriteFrame.cpp
|
||||
src/Athena/SpritePart.cpp
|
||||
|
||||
include/Athena/SakuraGlobal.hpp
|
||||
include/Athena/Sprite.hpp
|
||||
include/Athena/SpriteFile.hpp
|
||||
include/Athena/SpriteFileReader.hpp
|
||||
include/Athena/SpriteFileWriter.hpp
|
||||
include/Athena/SpriteFrame.hpp
|
||||
include/Athena/SpritePart.hpp
|
||||
)
|
||||
|
||||
add_library(AthenaWiiSave EXCLUDE_FROM_ALL
|
||||
src/Athena/WiiBanner.cpp
|
||||
src/Athena/WiiFile.cpp
|
||||
src/Athena/WiiImage.cpp
|
||||
src/Athena/WiiSave.cpp
|
||||
src/Athena/WiiSaveReader.cpp
|
||||
src/Athena/WiiSaveWriter.cpp
|
||||
src/bn.cpp
|
||||
src/ec.cpp
|
||||
src/md5.cpp
|
||||
src/sha1.cpp
|
||||
src/aes.cpp
|
||||
|
||||
include/Athena/WiiBanner.hpp
|
||||
include/Athena/WiiFile.hpp
|
||||
include/Athena/WiiImage.hpp
|
||||
include/Athena/WiiSave.hpp
|
||||
include/Athena/WiiSaveReader.hpp
|
||||
include/Athena/WiiSaveWriter.hpp
|
||||
include/aes.hpp
|
||||
include/bn.h
|
||||
include/ec.h
|
||||
include/md5.h
|
||||
include/sha1.h
|
||||
)
|
||||
if(NOT MSVC AND NOT GEKKO)
|
||||
set_source_files_properties(src/aes.cpp PROPERTIES COMPILE_FLAGS -maes)
|
||||
endif()
|
||||
|
||||
add_library(AthenaZelda EXCLUDE_FROM_ALL
|
||||
src/Athena/ALTTPFile.cpp
|
||||
src/Athena/ALTTPFileReader.cpp
|
||||
src/Athena/ALTTPFileWriter.cpp
|
||||
src/Athena/ALTTPQuest.cpp
|
||||
src/Athena/MCFile.cpp
|
||||
src/Athena/MCFileReader.cpp
|
||||
src/Athena/MCFileWriter.cpp
|
||||
src/Athena/MCSlot.cpp
|
||||
src/Athena/SkywardSwordFile.cpp
|
||||
src/Athena/SkywardSwordFileReader.cpp
|
||||
src/Athena/SkywardSwordFileWriter.cpp
|
||||
src/Athena/SkywardSwordQuest.cpp
|
||||
src/Athena/ZQuestFile.cpp
|
||||
src/Athena/ZQuestFileReader.cpp
|
||||
src/Athena/ZQuestFileWriter.cpp
|
||||
|
||||
include/Athena/ALTTPEnums.hpp
|
||||
include/Athena/ALTTPFile.hpp
|
||||
include/Athena/ALTTPFileReader.hpp
|
||||
include/Athena/ALTTPFileWriter.hpp
|
||||
include/Athena/ALTTPQuest.hpp
|
||||
include/Athena/ALTTPStructs.hpp
|
||||
include/Athena/MCFile.hpp
|
||||
include/Athena/MCFileReader.hpp
|
||||
include/Athena/MCFileWriter.hpp
|
||||
include/Athena/SkywardSwordFile.hpp
|
||||
include/Athena/SkywardSwordFileReader.hpp
|
||||
include/Athena/SkywardSwordFileWriter.hpp
|
||||
include/Athena/SkywardSwordQuest.hpp
|
||||
)
|
||||
|
||||
add_library(AthenaNet
|
||||
src/sockwrap.c
|
||||
src/Athena/Socket.cpp
|
||||
src/Athena/OAuth.cpp
|
||||
src/Athena/IPAddress.cpp
|
||||
|
||||
include/sockwrap.h
|
||||
include/Athena/Socket.hpp
|
||||
include/Athena/OAuth.hpp
|
||||
include/Athena/IPAddress.hpp)
|
||||
|
||||
# Icon
|
||||
set(ATHENA_ICO ${CMAKE_CURRENT_SOURCE_DIR}/Athena.ico)
|
||||
|
||||
# Offer the user the choice of overriding the installation directories
|
||||
set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
|
||||
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
set(INSTALL_CMAKE_DIR cmake)
|
||||
else()
|
||||
set(INSTALL_CMAKE_DIR lib/cmake/Athena)
|
||||
endif()
|
||||
|
||||
# Make relative paths absolute (needed later on)
|
||||
foreach(p LIB INCLUDE CMAKE)
|
||||
set(var INSTALL_${p}_DIR)
|
||||
if(NOT IS_ABSOLUTE "${${var}}")
|
||||
set(ABS_${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
|
||||
else()
|
||||
set(ABS_${var} "${${var}}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Define installs
|
||||
install(DIRECTORY include/ DESTINATION ${INSTALL_INCLUDE_DIR}/Athena COMPONENT Athena)
|
||||
install(TARGETS AthenaCore
|
||||
DESTINATION ${INSTALL_LIB_DIR} EXPORT AthenaTargets COMPONENT Athena)
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
install(FILES Athena.ico DESTINATION ${INSTALL_LIB_DIR} COMPONENT Athena)
|
||||
elseif(UNIX)
|
||||
configure_file(libAthena.pc.in libAthena.pc @ONLY)
|
||||
configure_file(PKGBUILD.in ${CMAKE_CURRENT_SOURCE_DIR}/PKGBUILD @ONLY)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/libAthena.pc
|
||||
DESTINATION ${INSTALL_LIB_DIR}/pkgconfig COMPONENT Athena)
|
||||
endif()
|
||||
|
||||
##################
|
||||
# Package Export #
|
||||
##################
|
||||
|
||||
# Add all targets to the build-tree export set
|
||||
export(TARGETS AthenaCore
|
||||
FILE "${PROJECT_BINARY_DIR}/AthenaTargets.cmake")
|
||||
|
||||
# Export the package for use from the build-tree
|
||||
# (this registers the build-tree with a global CMake-registry)
|
||||
export(PACKAGE Athena)
|
||||
|
||||
# Create the AthenaConfig.cmake
|
||||
# ... for the build tree
|
||||
set(CONF_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include/Athena")
|
||||
set(CONF_ICON_DIR "${PROJECT_SOURCE_DIR}/Athena.ico")
|
||||
configure_file(AthenaConfig.cmake.in "${PROJECT_BINARY_DIR}/AthenaConfig.cmake" @ONLY)
|
||||
# ... for the install tree
|
||||
file(RELATIVE_PATH REL_INCLUDE_DIR "${ABS_INSTALL_CMAKE_DIR}" "${ABS_INSTALL_INCLUDE_DIR}")
|
||||
file(RELATIVE_PATH REL_ICON_DIR "${ABS_INSTALL_CMAKE_DIR}" "${ABS_INSTALL_LIB_DIR}/Athena.ico")
|
||||
set(CONF_INCLUDE_DIR "\${ATHENA_CMAKE_DIR}/${REL_INCLUDE_DIR}/Athena")
|
||||
set(CONF_ICON_DIR "\${ATHENA_CMAKE_DIR}/${REL_ICON_DIR}")
|
||||
configure_file(AthenaConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/AthenaConfig.cmake" @ONLY)
|
||||
# ... for both
|
||||
configure_file(AthenaConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/AthenaConfigVersion.cmake" @ONLY)
|
||||
|
||||
# Install AthenaConfig.cmake
|
||||
install(FILES
|
||||
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/AthenaConfig.cmake"
|
||||
"${PROJECT_BINARY_DIR}/AthenaConfigVersion.cmake"
|
||||
DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT Athena)
|
||||
|
||||
# Install the export set for use with the install-tree
|
||||
install(EXPORT AthenaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT Athena)
|
||||
|
||||
################
|
||||
# atdna import #
|
||||
################
|
||||
|
||||
if(NOT GEKKO)
|
||||
add_subdirectory(atdna)
|
||||
endif()
|
||||
|
||||
#########
|
||||
# CPack #
|
||||
#########
|
||||
|
||||
include(InstallRequiredSystemLibraries)
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Athena")
|
||||
set(CPACK_PACKAGE_VENDOR "Antidote / Jackoalan")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${ATHENA_MAJOR_VERSION})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${ATHENA_MINOR_VERSION})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${ATHENA_PATCH_VERSION})
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Athena")
|
||||
if(WIN32 AND NOT UNIX)
|
||||
# There is a bug in NSI that does not handle full unix paths properly. Make
|
||||
# sure there is at least one set of four (4) backlasshes.
|
||||
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Athena")
|
||||
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\AthenaNSIS.bmp")
|
||||
set(CPACK_NSIS_MODIFY_PATH ON)
|
||||
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico")
|
||||
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico")
|
||||
set(CPACK_NSIS_INSTALLED_ICON_NAME "Uninstall.exe")
|
||||
set(CPACK_NSIS_DISPLAY_NAME "Athena")
|
||||
set(CPACK_NSIS_URL_INFO_ABOUT "http://libathena.github.io")
|
||||
set(CPACK_NSIS_CONTACT "antidote.crk@gmail.com")
|
||||
endif()
|
||||
include(CPack)
|
||||
|
||||
17
Example/CMakeLists.txt
Normal file
17
Example/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(Example)
|
||||
endif()
|
||||
|
||||
include_directories(${ATHENA_INCLUDE_DIR})
|
||||
add_executable(Example
|
||||
main.cpp)
|
||||
|
||||
if(GEKKO)
|
||||
include_directories(${LIBOGCDIR}/include)
|
||||
link_directories(${LIGOGCDIR}/lib/wii)
|
||||
target_link_libraries(Example AthenaCore z wiiuse bte ogc m)
|
||||
else()
|
||||
#TODO: add normal link libraries
|
||||
endif()
|
||||
|
||||
58
Example/main.cpp
Normal file
58
Example/main.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#include <iostream>
|
||||
#if GEKKO
|
||||
#include <gccore.h>
|
||||
#if HW_RVL
|
||||
#include <wiiuse/wpad.h>
|
||||
#endif
|
||||
|
||||
static void *xfb = nullptr;
|
||||
static GXRModeObj* rmode = nullptr;
|
||||
|
||||
#endif
|
||||
|
||||
#include <Athena/MemoryReader.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
#if GEKKO
|
||||
VIDEO_Init();
|
||||
#if HW_RVL
|
||||
WPAD_Init();
|
||||
#endif
|
||||
PAD_Init();
|
||||
|
||||
rmode = VIDEO_GetPreferredMode(nullptr);
|
||||
xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||
|
||||
CON_Init(xfb, 20, 20, rmode->fbWidth, rmode->xfbHeight, rmode->fbWidth * VI_DISPLAY_PIX_SZ);
|
||||
CON_EnableGecko(CARD_SLOTB, true);
|
||||
|
||||
VIDEO_Configure(rmode);
|
||||
VIDEO_SetBlack(false);
|
||||
|
||||
VIDEO_Flush();
|
||||
|
||||
VIDEO_WaitVSync();
|
||||
if (rmode->viTVMode & VI_NON_INTERLACE)
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
Athena::io::MemoryCopyReader test("sd:/test.dat");
|
||||
while(true)
|
||||
{
|
||||
#if HW_RVL
|
||||
WPAD_ScanPads();
|
||||
#endif
|
||||
PAD_ScanPads();
|
||||
if (PAD_ButtonsDown(0) & PAD_BUTTON_START)
|
||||
break;
|
||||
|
||||
#if HW_RVL
|
||||
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME)
|
||||
break;
|
||||
#endif
|
||||
VIDEO_WaitVSync();
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
20
LICENSE
Normal file
20
LICENSE
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2011-2015 Phillip "Antidote" Stephens, Jack Andersen, et al.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,14 +1,14 @@
|
||||
# PKGBUILD for libAthena
|
||||
_pkgname=libathena
|
||||
pkgname=$_pkgname-git
|
||||
pkgver=v1.0.0
|
||||
pkgver=@ATHENA_VERSION@
|
||||
pkgrel=1
|
||||
pkgdesc="Basic cross platform IO library"
|
||||
arch=('i686' 'x86_64')
|
||||
source=("${pkgname%-*}::git+https://github.com/Antidote/Athena.git")
|
||||
source=("${pkgname%-*}::git+https://github.com/libAthena/Athena.git")
|
||||
options=(staticlibs)
|
||||
license="GPL3"
|
||||
makedepends=('git qt5-base sed')
|
||||
license="MIT"
|
||||
makedepends=('git cmake sed')
|
||||
md5sums=('SKIP')
|
||||
sha256sums=('SKIP')
|
||||
|
||||
@@ -19,11 +19,14 @@ pkgver() {
|
||||
|
||||
build() {
|
||||
cd "$srcdir/$_pkgname"
|
||||
qmake && make
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$pkgdir/usr" ..
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$srcdir/$_pkgname"
|
||||
qmake PREFIX="$pkgdir/usr" && make install
|
||||
cd "$srcdir/$_pkgname/build"
|
||||
make install
|
||||
}
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
# Athena
|
||||
[](https://travis-ci.org/Antidote/Athena)
|
||||
|
||||
179
atdna/CMakeLists.txt
Normal file
179
atdna/CMakeLists.txt
Normal file
@@ -0,0 +1,179 @@
|
||||
###############
|
||||
# ATDNA Build #
|
||||
###############
|
||||
|
||||
# Force this binary to Release flags (to make MSVC happy)
|
||||
if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
|
||||
endif()
|
||||
|
||||
# Find dependencies
|
||||
include(FindLLVM.cmake)
|
||||
if(NOT LLVM_FOUND)
|
||||
message("-- Unable to locate LLVM installation; skipping atdna")
|
||||
else()
|
||||
list(APPEND LLVM_LIBS
|
||||
clangFrontend
|
||||
clangTooling
|
||||
clangDriver
|
||||
clangSerialization
|
||||
clangParse
|
||||
clangSema
|
||||
clangAnalysis
|
||||
clangEdit
|
||||
clangAST
|
||||
clangLex
|
||||
clangBasic
|
||||
LLVMOption
|
||||
LLVMMCParser
|
||||
LLVMBitReader
|
||||
LLVMMC
|
||||
LLVMSupport)
|
||||
set(CLANG_INCLUDE_DIR ${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_STRING}/include
|
||||
CACHE PATH "Clang include dir" FORCE)
|
||||
|
||||
if(UNIX)
|
||||
list(APPEND PLAT_LIBS z pthread curses)
|
||||
if (APPLE)
|
||||
list(APPEND PLAT_LIBS dl)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
list(APPEND PLAT_LIBS dl)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Offer the user the choice of overriding the installation directories
|
||||
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
|
||||
set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
set(INSTALL_CMAKE_DIR cmake)
|
||||
else()
|
||||
set(INSTALL_CMAKE_DIR lib/cmake/atdna)
|
||||
endif()
|
||||
|
||||
# Make relative paths absolute (needed later on)
|
||||
foreach(p BIN INCLUDE CMAKE)
|
||||
set(var INSTALL_${p}_DIR)
|
||||
if(NOT IS_ABSOLUTE "${${var}}")
|
||||
set(ABS_${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
|
||||
else()
|
||||
set(ABS_${var} "${${var}}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Windows resource
|
||||
if(WIN32)
|
||||
configure_file(main.rc.in main.rc @ONLY)
|
||||
set(PLAT_SRCS ${CMAKE_CURRENT_BINARY_DIR}/main.rc)
|
||||
endif()
|
||||
|
||||
# ATDNA target
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
include_directories(${LLVM_INCLUDE_DIRS})
|
||||
link_directories(${LLVM_LIBRARY_DIRS})
|
||||
add_executable(atdna main.cpp test.hpp ${PLAT_SRCS})
|
||||
target_link_libraries(atdna ${LLVM_LIBS} ${PLAT_LIBS})
|
||||
set_source_files_properties(main.cpp PROPERTIES COMPILE_DEFINITIONS
|
||||
"INSTALL_PREFIX=${ABS_INSTALL_BIN_DIR};__STDC_LIMIT_MACROS=1;__STDC_CONSTANT_MACROS=1")
|
||||
if(MSVC)
|
||||
set_target_properties(atdna PROPERTIES
|
||||
COMPILE_FLAGS "/GR-")
|
||||
else()
|
||||
set_target_properties(atdna PROPERTIES
|
||||
COMPILE_FLAGS "-std=c++11 -fno-rtti -Wno-unused-parameter"
|
||||
LINK_FLAGS -std=c++11)
|
||||
endif()
|
||||
|
||||
# Define installs
|
||||
install(TARGETS atdna DESTINATION ${INSTALL_BIN_DIR} EXPORT atdnaTargets COMPONENT atdna)
|
||||
install(DIRECTORY ${CLANG_INCLUDE_DIR}/ DESTINATION ${INSTALL_INCLUDE_DIR}/Athena/clang COMPONENT atdna)
|
||||
|
||||
##################
|
||||
# Package Export #
|
||||
##################
|
||||
|
||||
# Add all targets to the build-tree export set
|
||||
export(TARGETS atdna FILE "${PROJECT_BINARY_DIR}/atdnaTargets.cmake")
|
||||
|
||||
# Export the package for use from the build-tree
|
||||
# (this registers the build-tree with a global CMake-registry)
|
||||
export(PACKAGE atdna)
|
||||
|
||||
# Create the atdnaConfig.cmake
|
||||
# ... for the build tree
|
||||
set(CONF_CLANG_INCLUDE_DIR "${CLANG_INCLUDE_DIR}")
|
||||
configure_file(atdnaConfig.cmake.in "${PROJECT_BINARY_DIR}/atdnaConfig.cmake" @ONLY)
|
||||
# ... for the install tree
|
||||
set(CONF_CLANG_INCLUDE_DIR "\${ATHENA_INCLUDE_DIR}/clang")
|
||||
configure_file(atdnaConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atdnaConfig.cmake" @ONLY)
|
||||
# ... for both
|
||||
configure_file(atdnaConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/atdnaConfigVersion.cmake" @ONLY)
|
||||
|
||||
# Install atdnaConfig.cmake
|
||||
install(FILES
|
||||
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atdnaConfig.cmake"
|
||||
"${PROJECT_BINARY_DIR}/atdnaConfigVersion.cmake"
|
||||
DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT atdna)
|
||||
|
||||
# Install the export set for use with the install-tree
|
||||
install(EXPORT atdnaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT atdna)
|
||||
|
||||
#########
|
||||
# CTest #
|
||||
#########
|
||||
|
||||
enable_testing()
|
||||
add_test(NAME test-dna COMMAND $<TARGET_FILE:atdna> -o test.cpp
|
||||
"-I${ATHENA_INCLUDE_DIR}" -isystem "${CLANG_INCLUDE_DIR}"
|
||||
${CMAKE_SOURCE_DIR}/test.hpp)
|
||||
|
||||
endif()
|
||||
|
||||
#######################
|
||||
# In-tree atdna macro #
|
||||
#######################
|
||||
|
||||
# Super handy macro for adding atdna target
|
||||
macro(atdna out)
|
||||
# Make input files source-relative
|
||||
set(ins "")
|
||||
foreach(arg ${ARGN})
|
||||
list(APPEND ins ${CMAKE_CURRENT_SOURCE_DIR}/${arg})
|
||||
endforeach()
|
||||
|
||||
# Get local include directories for atdna
|
||||
get_property(incdirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
||||
set(inccli "")
|
||||
foreach(dir ${incdirs})
|
||||
list(APPEND inccli "-I${dir}")
|
||||
endforeach()
|
||||
|
||||
# Get local defines for atdna
|
||||
get_property(cdefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY COMPILE_DEFINITIONS)
|
||||
set(cdefcli "")
|
||||
foreach(def ${cdefs})
|
||||
list(APPEND cdefcli "-D${def}")
|
||||
endforeach()
|
||||
|
||||
# MS extra
|
||||
unset(extraargs)
|
||||
if(MSVC)
|
||||
list(APPEND extraargs -fms-compatibility -fexceptions)
|
||||
if(MSVC_VERSION EQUAL 1800)
|
||||
list(APPEND extraargs -fms-compatibility-version=18.00)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
list(APPEND extraargs -fms-compatibility-version=19.00)
|
||||
endif()
|
||||
|
||||
# OSX Extra
|
||||
elseif(APPLE)
|
||||
list(APPEND extraargs -isysroot ${CMAKE_OSX_SYSROOT} -isysroot
|
||||
${CMAKE_OSX_SYSROOT}/../../../../../Toolchains/XcodeDefault.xctoolchain)
|
||||
endif()
|
||||
|
||||
# Make target
|
||||
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
||||
ARGS ${extraargs} -o ${out} ${cdefcli} ${inccli} "-I${ATHENA_INCLUDE_DIR}"
|
||||
-isystem "${CLANG_INCLUDE_DIR}" ${ins}
|
||||
DEPENDS ${ins} COMMENT "Generating DNA ${out}")
|
||||
endmacro()
|
||||
205
atdna/FindLLVM.cmake
Normal file
205
atdna/FindLLVM.cmake
Normal file
@@ -0,0 +1,205 @@
|
||||
# - Find LLVM headers and libraries.
|
||||
# This module locates LLVM and adapts the llvm-config output for use with
|
||||
# CMake.
|
||||
#
|
||||
# A given list of COMPONENTS is passed to llvm-config.
|
||||
#
|
||||
# The following variables are defined:
|
||||
# LLVM_FOUND - true if LLVM was found
|
||||
# LLVM_CXXFLAGS - C++ compiler flags for files that include LLVM headers.
|
||||
# LLVM_HOST_TARGET - Target triple used to configure LLVM.
|
||||
# LLVM_INCLUDE_DIRS - Directory containing LLVM include files.
|
||||
# LLVM_LDFLAGS - Linker flags to add when linking against LLVM
|
||||
# (includes -LLLVM_LIBRARY_DIRS).
|
||||
# LLVM_LIBRARIES - Full paths to the library files to link against.
|
||||
# LLVM_LIBRARY_DIRS - Directory containing LLVM libraries.
|
||||
# LLVM_ROOT_DIR - The root directory of the LLVM installation.
|
||||
# llvm-config is searched for in ${LLVM_ROOT_DIR}/bin.
|
||||
# LLVM_VERSION_MAJOR - Major version of LLVM.
|
||||
# LLVM_VERSION_MINOR - Minor version of LLVM.
|
||||
# LLVM_VERSION_STRING - Full LLVM version string (e.g. 2.9).
|
||||
#
|
||||
# Note: The variable names were chosen in conformance with the offical CMake
|
||||
# guidelines, see ${CMAKE_ROOT}/Modules/readme.txt.
|
||||
|
||||
# Try suffixed versions to pick up the newest LLVM install available on Debian
|
||||
# derivatives.
|
||||
# We also want an user-specified LLVM_ROOT_DIR to take precedence over the
|
||||
# system default locations such as /usr/local/bin. Executing find_program()
|
||||
# multiples times is the approach recommended in the docs.
|
||||
set(LLVM_FIND_COMPONENTS "")
|
||||
if(WIN32)
|
||||
get_filename_component(LLVM_ROOT_DIR [HKEY_LOCAL_MACHINE\\Software\\LLVM\\LLVM] ABSOLUTE)
|
||||
endif()
|
||||
|
||||
set(llvm_config_names llvm-config-3.7 llvm-config37
|
||||
llvm-config-3.6 llvm-config36
|
||||
llvm-config-3.5 llvm-config35
|
||||
llvm-config-3.4 llvm-config34
|
||||
llvm-config-3.3 llvm-config33
|
||||
llvm-config-3.2 llvm-config32
|
||||
llvm-config-3.1 llvm-config31 llvm-config)
|
||||
find_program(LLVM_CONFIG
|
||||
NAMES ${llvm_config_names}
|
||||
PATHS ${LLVM_ROOT_DIR}/bin NO_DEFAULT_PATH
|
||||
DOC "Path to llvm-config tool.")
|
||||
find_program(LLVM_CONFIG NAMES ${llvm_config_names})
|
||||
|
||||
if ((WIN32 AND NOT(MINGW OR CYGWIN)) OR NOT LLVM_CONFIG)
|
||||
if (WIN32)
|
||||
# A bit of a sanity check:
|
||||
if( NOT EXISTS ${LLVM_ROOT_DIR}/include/llvm )
|
||||
message(FATAL_ERROR "LLVM_ROOT_DIR (${LLVM_ROOT_DIR}) is not a valid LLVM install")
|
||||
endif()
|
||||
# We incorporate the CMake features provided by LLVM:
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${LLVM_ROOT_DIR}/share/llvm/cmake")
|
||||
include(LLVMConfig)
|
||||
# Set properties
|
||||
set(LLVM_HOST_TARGET ${TARGET_TRIPLE})
|
||||
set(LLVM_VERSION_STRING ${LLVM_PACKAGE_VERSION})
|
||||
set(LLVM_CXXFLAGS ${LLVM_DEFINITIONS})
|
||||
set(LLVM_LDFLAGS "")
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "all-targets" index)
|
||||
list(APPEND LLVM_FIND_COMPONENTS ${LLVM_TARGETS_TO_BUILD})
|
||||
# Work around LLVM bug 21016
|
||||
list(FIND LLVM_TARGETS_TO_BUILD "X86" TARGET_X86)
|
||||
if(TARGET_X86 GREATER -1)
|
||||
list(APPEND LLVM_FIND_COMPONENTS x86utils)
|
||||
endif()
|
||||
# Similar to the work around above, but for AArch64
|
||||
list(FIND LLVM_TARGETS_TO_BUILD "AArch64" TARGET_AArch64)
|
||||
if(TARGET_AArch64 GREATER -1)
|
||||
list(APPEND LLVM_FIND_COMPONENTS AArch64Utils)
|
||||
endif()
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "backend" index)
|
||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-2][\\.0-9A-Za-z]*")
|
||||
# Versions below 3.3 do not support components objcarcopts, option
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "objcarcopts" index)
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "option" index)
|
||||
endif()
|
||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
||||
# Versions below 3.5 do not support components lto, profiledata
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "lto" index)
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "profiledata" index)
|
||||
endif()
|
||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-6][\\.0-9A-Za-z]*")
|
||||
# Versions below 3.7 do not support components debuginfodwarf
|
||||
# Only debuginfo is available
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "debuginfodwarf" index)
|
||||
list(APPEND LLVM_FIND_COMPONENTS "debuginfo")
|
||||
endif()
|
||||
|
||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
||||
llvm_map_components_to_libraries(tmplibs ${LLVM_FIND_COMPONENTS})
|
||||
else()
|
||||
llvm_map_components_to_libnames(tmplibs ${LLVM_FIND_COMPONENTS})
|
||||
endif()
|
||||
if(MSVC)
|
||||
foreach(lib ${tmplibs})
|
||||
list(APPEND LLVM_LIBRARIES "${LLVM_LIBRARY_DIRS}/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endforeach()
|
||||
else()
|
||||
# Rely on the library search path being set correctly via -L on
|
||||
# MinGW and others, as the library list returned by
|
||||
# llvm_map_components_to_libraries also includes imagehlp and psapi.
|
||||
set(LLVM_LDFLAGS "-L${LLVM_LIBRARY_DIRS}")
|
||||
set(LLVM_LIBRARIES ${tmplibs})
|
||||
endif()
|
||||
|
||||
# When using the CMake LLVM module, LLVM_DEFINITIONS is a list
|
||||
# instead of a string. Later, the list seperators would entirely
|
||||
# disappear, replace them by spaces instead. A better fix would be
|
||||
# to switch to add_definitions() instead of throwing strings around.
|
||||
string(REPLACE ";" " " LLVM_CXXFLAGS "${LLVM_CXXFLAGS}")
|
||||
else()
|
||||
if (NOT FIND_LLVM_QUIETLY)
|
||||
message(WARNING "Could not find llvm-config. Try manually setting LLVM_ROOT_DIR to the prebuilt LLVM prefix to use.")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
macro(llvm_set var flag)
|
||||
if(LLVM_FIND_QUIETLY)
|
||||
set(_quiet_arg ERROR_QUIET)
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG} --${flag}
|
||||
OUTPUT_VARIABLE LLVM_${var}
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
${_quiet_arg}
|
||||
)
|
||||
if(${ARGV2})
|
||||
file(TO_CMAKE_PATH "${LLVM_${var}}" LLVM_${var})
|
||||
endif()
|
||||
endmacro()
|
||||
macro(llvm_set_libs var flag prefix)
|
||||
if(LLVM_FIND_QUIETLY)
|
||||
set(_quiet_arg ERROR_QUIET)
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG} --${flag} ${LLVM_FIND_COMPONENTS}
|
||||
OUTPUT_VARIABLE tmplibs
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
${_quiet_arg}
|
||||
)
|
||||
file(TO_CMAKE_PATH "${tmplibs}" tmplibs)
|
||||
string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" pattern "${prefix}/")
|
||||
string(REGEX MATCHALL "${pattern}[^ ]+" LLVM_${var} ${tmplibs})
|
||||
endmacro()
|
||||
|
||||
llvm_set(VERSION_STRING version)
|
||||
llvm_set(CXXFLAGS cxxflags)
|
||||
llvm_set(HOST_TARGET host-target)
|
||||
llvm_set(INCLUDE_DIRS includedir true)
|
||||
llvm_set(ROOT_DIR prefix true)
|
||||
|
||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-2][\\.0-9A-Za-z]*")
|
||||
# Versions below 3.3 do not support components objcarcopts, option
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "objcarcopts" index)
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "option" index)
|
||||
endif()
|
||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
||||
# Versions below 3.5 do not support components lto, profiledata
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "lto" index)
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "profiledata" index)
|
||||
endif()
|
||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-6][\\.0-9A-Za-z]*")
|
||||
# Versions below 3.7 do not support components debuginfodwarf
|
||||
# Only debuginfo is available
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "debuginfodwarf" index)
|
||||
list(APPEND LLVM_FIND_COMPONENTS "debuginfo")
|
||||
endif()
|
||||
|
||||
llvm_set(LDFLAGS ldflags)
|
||||
if(NOT ${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
||||
# In LLVM 3.5+, the system library dependencies (e.g. "-lz") are accessed
|
||||
# using the separate "--system-libs" flag.
|
||||
llvm_set(SYSTEM_LIBS system-libs)
|
||||
string(REPLACE "\n" " " LLVM_LDFLAGS "${LLVM_LDFLAGS} ${LLVM_SYSTEM_LIBS}")
|
||||
endif()
|
||||
llvm_set(LIBRARY_DIRS libdir true)
|
||||
llvm_set_libs(LIBRARIES libfiles "${LLVM_LIBRARY_DIRS}")
|
||||
endif()
|
||||
|
||||
# On CMake builds of LLVM, the output of llvm-config --cxxflags does not
|
||||
# include -fno-rtti, leading to linker errors. Be sure to add it.
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||
if(NOT ${LLVM_CXXFLAGS} MATCHES "-fno-rtti")
|
||||
set(LLVM_CXXFLAGS "${LLVM_CXXFLAGS} -fno-rtti")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(REGEX REPLACE "([0-9]+).*" "\\1" LLVM_VERSION_MAJOR "${LLVM_VERSION_STRING}" )
|
||||
string(REGEX REPLACE "[0-9]+\\.([0-9]+).*[A-Za-z]*" "\\1" LLVM_VERSION_MINOR "${LLVM_VERSION_STRING}" )
|
||||
|
||||
# Use the default CMake facilities for handling QUIET/REQUIRED.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_LESS "2.8.4")
|
||||
# The VERSION_VAR argument is not supported on pre-2.8.4, work around this.
|
||||
set(VERSION_VAR dummy)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(LLVM
|
||||
REQUIRED_VARS LLVM_ROOT_DIR LLVM_HOST_TARGET
|
||||
VERSION_VAR LLVM_VERSION_STRING)
|
||||
|
||||
3
atdna/README.md
Normal file
3
atdna/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# atdna
|
||||
[User Overview](http://libAthena.github.io/doc/atdna.html)
|
||||
[DNA Record Reference](http://libAthena.github.io/doc/atdna-ref.html)
|
||||
58
atdna/atdnaConfig.cmake.in
Normal file
58
atdna/atdnaConfig.cmake.in
Normal file
@@ -0,0 +1,58 @@
|
||||
# - Config file for the atdna package
|
||||
|
||||
# Compute paths
|
||||
get_filename_component(ATHENA_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||
if(NOT TARGET atdna AND NOT atdna_BINARY_DIR)
|
||||
include("${ATHENA_CMAKE_DIR}/atdnaTargets.cmake")
|
||||
endif()
|
||||
|
||||
# Find Athena
|
||||
find_package(Athena REQUIRED)
|
||||
|
||||
# Super handy macro for adding atdna target
|
||||
macro(atdna out)
|
||||
# Make input files source-relative
|
||||
set(ins "")
|
||||
foreach(arg ${ARGN})
|
||||
list(APPEND ins ${CMAKE_CURRENT_SOURCE_DIR}/${arg})
|
||||
endforeach()
|
||||
|
||||
# Get local include directories for atdna
|
||||
get_property(incdirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
||||
set(inccli "")
|
||||
foreach(dir ${incdirs})
|
||||
list(APPEND inccli "-I${dir}")
|
||||
endforeach()
|
||||
|
||||
# Get local defines for atdna
|
||||
get_property(cdefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY COMPILE_DEFINITIONS)
|
||||
set(cdefcli "")
|
||||
foreach(def ${cdefs})
|
||||
list(APPEND cdefcli "-D${def}")
|
||||
endforeach()
|
||||
|
||||
# MS extra
|
||||
unset(extraargs)
|
||||
if(MSVC)
|
||||
list(APPEND extraargs -fms-compatibility -fexceptions)
|
||||
if(MSVC_VERSION EQUAL 1800)
|
||||
list(APPEND extraargs -fms-compatibility-version=18.00)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
list(APPEND extraargs -fms-compatibility-version=19.00)
|
||||
endif()
|
||||
|
||||
# OSX Extra
|
||||
elseif(APPLE)
|
||||
list(APPEND extraargs -isysroot ${CMAKE_OSX_SYSROOT} -isysroot
|
||||
${CMAKE_OSX_SYSROOT}/../../../../../Toolchains/XcodeDefault.xctoolchain)
|
||||
endif()
|
||||
|
||||
# Make target
|
||||
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
||||
ARGS ${extraargs} -o ${out} ${cdefcli} ${inccli} "-I${ATHENA_INCLUDE_DIR}"
|
||||
-isystem "@CONF_CLANG_INCLUDE_DIR@" ${ins}
|
||||
DEPENDS ${ins} COMMENT "Generating DNA ${out}")
|
||||
endmacro()
|
||||
|
||||
12
atdna/atdnaConfigVersion.cmake.in
Normal file
12
atdna/atdnaConfigVersion.cmake.in
Normal file
@@ -0,0 +1,12 @@
|
||||
set(PACKAGE_VERSION "@ATHENA_VERSION@")
|
||||
|
||||
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
2276
atdna/main.cpp
Normal file
2276
atdna/main.cpp
Normal file
File diff suppressed because it is too large
Load Diff
32
atdna/main.rc.in
Normal file
32
atdna/main.rc.in
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "winver.h"
|
||||
|
||||
IDI_ICON1 ICON DISCARDABLE "@ATHENA_ICO@"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION @ATHENA_MAJOR_VERSION@,@ATHENA_MINOR_VERSION@,@ATHENA_PATCH_VERSION@,0
|
||||
PRODUCTVERSION @ATHENA_MAJOR_VERSION@,@ATHENA_MINOR_VERSION@,@ATHENA_PATCH_VERSION@,0
|
||||
FILEFLAGS 0x0L
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEOS 0x00040004L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Jackoalan / Antidote"
|
||||
VALUE "FileDescription", "ATDNA"
|
||||
VALUE "FileVersion", "@ATHENA_MAJOR_VERSION@.@ATHENA_MINOR_VERSION@.@ATHENA_PATCH_VERSION@"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2015 Jackoalan / Antidote"
|
||||
VALUE "InternalName", "atdna"
|
||||
VALUE "OriginalFilename", "atdna.exe"
|
||||
VALUE "ProductName", "ATDNA"
|
||||
VALUE "ProductVersion", "@ATHENA_MAJOR_VERSION@.@ATHENA_MINOR_VERSION@.@ATHENA_PATCH_VERSION@"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0, 1200
|
||||
END
|
||||
END
|
||||
78
atdna/test.hpp
Normal file
78
atdna/test.hpp
Normal file
@@ -0,0 +1,78 @@
|
||||
#include <Athena/DNAYaml.hpp>
|
||||
|
||||
using namespace Athena;
|
||||
typedef io::DNAYaml<BigEndian> BigDNA;
|
||||
|
||||
struct TESTSubFile : public BigDNA
|
||||
{
|
||||
DECL_YAML
|
||||
enum ETest : atUint8
|
||||
{
|
||||
ZERO,
|
||||
ONE,
|
||||
TWO,
|
||||
THREE
|
||||
};
|
||||
Value<ETest> varE;
|
||||
Value<atUint32> sub1;
|
||||
Value<atUint32> sub2;
|
||||
};
|
||||
|
||||
struct TESTSubClassFile : public TESTSubFile
|
||||
{
|
||||
DECL_YAML
|
||||
Value<atUint32> sub3;
|
||||
Value<atUint32> sub4;
|
||||
};
|
||||
|
||||
struct TESTSubSubClassFile : public TESTSubClassFile
|
||||
{
|
||||
DECL_YAML
|
||||
Value<atUint32> sub5;
|
||||
Value<atUint32> sub6;
|
||||
};
|
||||
|
||||
struct TESTFile : public BigDNA
|
||||
{
|
||||
DECL_YAML
|
||||
Value<bool> varBool;
|
||||
Value<atUint32> var32;
|
||||
Value<atUint16> var16;
|
||||
Value<atVec3f> vec3;
|
||||
Value<atVec4f> vec4;
|
||||
|
||||
struct TESTNestedSubFile : public BigDNA
|
||||
{
|
||||
DECL_YAML
|
||||
Value<atUint32> nestSub1;
|
||||
Value<atUint32> nestSub2;
|
||||
} nestedSubFile;
|
||||
|
||||
using TESTSubFileUsing = TESTSubFile;
|
||||
TESTSubFileUsing subFile;
|
||||
|
||||
Align<4> align;
|
||||
|
||||
struct TESTExplicitSubFile : public BigDNA
|
||||
{
|
||||
DECL_YAML
|
||||
Value<atUint32> explSub1;
|
||||
Value<atUint32> explSub2;
|
||||
} explSubFile;
|
||||
|
||||
Value<atUint32, LittleEndian> arrCount[2];
|
||||
Vector<atUint32, DNA_COUNT(arrCount[0])> array;
|
||||
|
||||
Seek<21, Current> seek;
|
||||
|
||||
Value<atUint32> arrCount2;
|
||||
Vector<TESTSubFile, DNA_COUNT(arrCount[1] + arrCount2)> array2;
|
||||
|
||||
Value<atUint32> bufSz;
|
||||
Buffer<DNA_COUNT(bufSz)> buf;
|
||||
|
||||
String<32> str;
|
||||
WString<64> wstr;
|
||||
WStringAsString<> utf8str[5];
|
||||
};
|
||||
|
||||
3
extern/CMakeLists.txt
vendored
Normal file
3
extern/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
add_subdirectory(lzo)
|
||||
add_subdirectory(zlib)
|
||||
add_subdirectory(yaml)
|
||||
88
extern/lzo/CMakeLists.txt
vendored
Normal file
88
extern/lzo/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
if(NOT WIN32 AND NOT APPLE)
|
||||
find_library(LZO_LIB lzo2)
|
||||
endif()
|
||||
if(WIN32 OR APPLE OR LZO_LIB STREQUAL LZO_LIB-NOTFOUND)
|
||||
include_directories(include)
|
||||
message("-- Using Athena's built-in lzo")
|
||||
add_library(lzo2
|
||||
src/lzo1.c
|
||||
src/lzo1_99.c
|
||||
src/lzo1a.c
|
||||
src/lzo1a_99.c
|
||||
src/lzo1b_1.c
|
||||
src/lzo1b_2.c
|
||||
src/lzo1b_3.c
|
||||
src/lzo1b_4.c
|
||||
src/lzo1b_5.c
|
||||
src/lzo1b_6.c
|
||||
src/lzo1b_7.c
|
||||
src/lzo1b_8.c
|
||||
src/lzo1b_9.c
|
||||
src/lzo1b_99.c
|
||||
src/lzo1b_9x.c
|
||||
src/lzo1b_cc.c
|
||||
src/lzo1b_d1.c
|
||||
src/lzo1b_d2.c
|
||||
src/lzo1b_rr.c
|
||||
src/lzo1b_xx.c
|
||||
src/lzo1c_1.c
|
||||
src/lzo1c_2.c
|
||||
src/lzo1c_3.c
|
||||
src/lzo1c_4.c
|
||||
src/lzo1c_5.c
|
||||
src/lzo1c_6.c
|
||||
src/lzo1c_7.c
|
||||
src/lzo1c_8.c
|
||||
src/lzo1c_9.c
|
||||
src/lzo1c_99.c
|
||||
src/lzo1c_9x.c
|
||||
src/lzo1c_cc.c
|
||||
src/lzo1c_d1.c
|
||||
src/lzo1c_d2.c
|
||||
src/lzo1c_rr.c
|
||||
src/lzo1c_xx.c
|
||||
src/lzo1f_1.c
|
||||
src/lzo1f_9x.c
|
||||
src/lzo1f_d1.c
|
||||
src/lzo1f_d2.c
|
||||
src/lzo1x_1.c
|
||||
src/lzo1x_1k.c
|
||||
src/lzo1x_1l.c
|
||||
src/lzo1x_1o.c
|
||||
src/lzo1x_9x.c
|
||||
src/lzo1x_d1.c
|
||||
src/lzo1x_d2.c
|
||||
src/lzo1x_d3.c
|
||||
src/lzo1x_o.c
|
||||
src/lzo1y_1.c
|
||||
src/lzo1y_9x.c
|
||||
src/lzo1y_d1.c
|
||||
src/lzo1y_d2.c
|
||||
src/lzo1y_d3.c
|
||||
src/lzo1y_o.c
|
||||
src/lzo1z_9x.c
|
||||
src/lzo1z_d1.c
|
||||
src/lzo1z_d2.c
|
||||
src/lzo1z_d3.c
|
||||
src/lzo2a_9x.c
|
||||
src/lzo2a_d1.c
|
||||
src/lzo2a_d2.c
|
||||
src/lzo_crc.c
|
||||
src/lzo_init.c
|
||||
src/lzo_ptr.c
|
||||
src/lzo_str.c
|
||||
src/lzo_util.c
|
||||
include/lzo/lzo1.h
|
||||
include/lzo/lzo1x.h
|
||||
include/lzo/lzoconf.h
|
||||
include/lzo/lzodefs.h
|
||||
include/lzo/lzoutil.h)
|
||||
if(WIN32 AND NOT UNIX)
|
||||
install(DIRECTORY include/lzo DESTINATION include COMPONENT lzo2)
|
||||
install(TARGETS lzo2 DESTINATION lib COMPONENT lzo2)
|
||||
endif()
|
||||
set(LZO_LIB lzo2 CACHE PATH "LZO library" FORCE)
|
||||
set(LZO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE PATH "LZO include path" FORCE)
|
||||
else()
|
||||
find_path(LZO_INCLUDE_DIR lzo/lzo1x.h)
|
||||
endif()
|
||||
18
extern/lzo/include/lzo/lzo1.h
vendored
18
extern/lzo/include/lzo/lzo1.h
vendored
@@ -51,14 +51,14 @@ extern "C" {
|
||||
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1_decompress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -68,9 +68,9 @@ lzo1_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||
#define LZO1_99_MEM_COMPRESS ((lzo_uint32_t) (65536L * lzo_sizeof_dict_t))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1_99_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1_99_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
|
||||
|
||||
18
extern/lzo/include/lzo/lzo1a.h
vendored
18
extern/lzo/include/lzo/lzo1a.h
vendored
@@ -51,14 +51,14 @@ extern "C" {
|
||||
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1a_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1a_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1a_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1a_decompress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -68,9 +68,9 @@ lzo1a_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||
#define LZO1A_99_MEM_COMPRESS ((lzo_uint32_t) (65536L * lzo_sizeof_dict_t))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1a_99_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1a_99_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
|
||||
|
||||
86
extern/lzo/include/lzo/lzo1b.h
vendored
86
extern/lzo/include/lzo/lzo1b.h
vendored
@@ -57,22 +57,22 @@ extern "C" {
|
||||
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
int compression_level );
|
||||
lzo1b_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
int compression_level);
|
||||
|
||||
/* decompression */
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1b_decompress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
/* safe decompression with overrun testing */
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1b_decompress_safe(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -80,41 +80,41 @@ lzo1b_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1b_1_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_2_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1b_2_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_3_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1b_3_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_4_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1b_4_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_5_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1b_5_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_6_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1b_6_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_7_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1b_7_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_8_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1b_8_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_9_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1b_9_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -124,17 +124,17 @@ lzo1b_9_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
#define LZO1B_99_MEM_COMPRESS ((lzo_uint32_t) (65536L * lzo_sizeof_dict_t))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_99_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1b_99_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
#define LZO1B_999_MEM_COMPRESS ((lzo_uint32_t) (3 * 65536L * sizeof(lzo_xint)))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_999_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1b_999_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
|
||||
|
||||
86
extern/lzo/include/lzo/lzo1c.h
vendored
86
extern/lzo/include/lzo/lzo1c.h
vendored
@@ -57,22 +57,22 @@ extern "C" {
|
||||
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
int compression_level );
|
||||
lzo1c_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
int compression_level);
|
||||
|
||||
/* decompression */
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1c_decompress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
/* safe decompression with overrun testing */
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1c_decompress_safe(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -80,41 +80,41 @@ lzo1c_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1c_1_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_2_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1c_2_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_3_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1c_3_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_4_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1c_4_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_5_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1c_5_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_6_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1c_6_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_7_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1c_7_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_8_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1c_8_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_9_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1c_9_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -124,17 +124,17 @@ lzo1c_9_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
#define LZO1C_99_MEM_COMPRESS ((lzo_uint32_t) (65536L * lzo_sizeof_dict_t))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_99_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1c_99_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
#define LZO1C_999_MEM_COMPRESS ((lzo_uint32_t) (5 * 16384L * sizeof(short)))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_999_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1c_999_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
|
||||
|
||||
24
extern/lzo/include/lzo/lzo1f.h
vendored
24
extern/lzo/include/lzo/lzo1f.h
vendored
@@ -52,15 +52,15 @@ extern "C" {
|
||||
|
||||
/* decompression */
|
||||
LZO_EXTERN(int)
|
||||
lzo1f_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1f_decompress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
/* safe decompression with overrun testing */
|
||||
LZO_EXTERN(int)
|
||||
lzo1f_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1f_decompress_safe(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -68,9 +68,9 @@ lzo1f_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1f_1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1f_1_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -80,9 +80,9 @@ lzo1f_1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
#define LZO1F_999_MEM_COMPRESS ((lzo_uint32_t) (5 * 16384L * sizeof(short)))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1f_999_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1f_999_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
|
||||
|
||||
76
extern/lzo/include/lzo/lzo1x.h
vendored
76
extern/lzo/include/lzo/lzo1x.h
vendored
@@ -53,15 +53,15 @@ extern "C" {
|
||||
|
||||
/* decompression */
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1x_decompress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
/* safe decompression with overrun testing */
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1x_decompress_safe(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -71,9 +71,9 @@ lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
#define LZO1X_1_MEM_COMPRESS ((lzo_uint32_t) (16384L * lzo_sizeof_dict_t))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1x_1_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -84,27 +84,27 @@ lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
#define LZO1X_1_11_MEM_COMPRESS ((lzo_uint32_t) (2048L * lzo_sizeof_dict_t))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_1_11_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1x_1_11_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
/* this version needs 16 KiB work memory */
|
||||
#define LZO1X_1_12_MEM_COMPRESS ((lzo_uint32_t) (4096L * lzo_sizeof_dict_t))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_1_12_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1x_1_12_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
/* use this version if you need a little more compression speed */
|
||||
#define LZO1X_1_15_MEM_COMPRESS ((lzo_uint32_t) (32768L * lzo_sizeof_dict_t))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_1_15_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1x_1_15_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -114,9 +114,9 @@ lzo1x_1_15_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
#define LZO1X_999_MEM_COMPRESS ((lzo_uint32_t) (14 * 16384L * sizeof(short)))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_999_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1x_999_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -124,24 +124,24 @@ lzo1x_999_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_999_compress_dict ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
lzo1x_999_compress_dict(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len);
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_999_compress_level ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len,
|
||||
lzo_callback_p cb,
|
||||
int compression_level );
|
||||
lzo1x_999_compress_level(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len,
|
||||
lzo_callback_p cb,
|
||||
int compression_level);
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_decompress_dict_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */,
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
lzo1x_decompress_dict_safe(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */,
|
||||
const lzo_bytep dict, lzo_uint dict_len);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -149,9 +149,9 @@ lzo1x_decompress_dict_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_optimize ( lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1x_optimize(lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
|
||||
|
||||
|
||||
58
extern/lzo/include/lzo/lzo1y.h
vendored
58
extern/lzo/include/lzo/lzo1y.h
vendored
@@ -53,15 +53,15 @@ extern "C" {
|
||||
|
||||
/* decompression */
|
||||
LZO_EXTERN(int)
|
||||
lzo1y_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1y_decompress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
/* safe decompression with overrun testing */
|
||||
LZO_EXTERN(int)
|
||||
lzo1y_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1y_decompress_safe(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -69,9 +69,9 @@ lzo1y_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1y_1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1y_1_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -81,9 +81,9 @@ lzo1y_1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
#define LZO1Y_999_MEM_COMPRESS ((lzo_uint32_t) (14 * 16384L * sizeof(short)))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1y_999_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1y_999_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
|
||||
@@ -92,24 +92,24 @@ lzo1y_999_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1y_999_compress_dict ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
lzo1y_999_compress_dict(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len);
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1y_999_compress_level ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len,
|
||||
lzo_callback_p cb,
|
||||
int compression_level );
|
||||
lzo1y_999_compress_level(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len,
|
||||
lzo_callback_p cb,
|
||||
int compression_level);
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1y_decompress_dict_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */,
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
lzo1y_decompress_dict_safe(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */,
|
||||
const lzo_bytep dict, lzo_uint dict_len);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -117,9 +117,9 @@ lzo1y_decompress_dict_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1y_optimize ( lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1y_optimize(lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
|
||||
|
||||
|
||||
46
extern/lzo/include/lzo/lzo1z.h
vendored
46
extern/lzo/include/lzo/lzo1z.h
vendored
@@ -51,15 +51,15 @@ extern "C" {
|
||||
|
||||
/* decompression */
|
||||
LZO_EXTERN(int)
|
||||
lzo1z_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1z_decompress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
/* safe decompression with overrun testing */
|
||||
LZO_EXTERN(int)
|
||||
lzo1z_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo1z_decompress_safe(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -69,9 +69,9 @@ lzo1z_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
#define LZO1Z_999_MEM_COMPRESS ((lzo_uint32_t) (14 * 16384L * sizeof(short)))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1z_999_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo1z_999_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -79,24 +79,24 @@ lzo1z_999_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1z_999_compress_dict ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
lzo1z_999_compress_dict(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len);
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1z_999_compress_level ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len,
|
||||
lzo_callback_p cb,
|
||||
int compression_level );
|
||||
lzo1z_999_compress_level(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len,
|
||||
lzo_callback_p cb,
|
||||
int compression_level);
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1z_decompress_dict_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */,
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
lzo1z_decompress_dict_safe(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */,
|
||||
const lzo_bytep dict, lzo_uint dict_len);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
18
extern/lzo/include/lzo/lzo2a.h
vendored
18
extern/lzo/include/lzo/lzo2a.h
vendored
@@ -46,15 +46,15 @@ extern "C" {
|
||||
|
||||
/* decompression */
|
||||
LZO_EXTERN(int)
|
||||
lzo2a_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo2a_decompress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
/* safe decompression with overrun testing */
|
||||
LZO_EXTERN(int)
|
||||
lzo2a_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
lzo2a_decompress_safe(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -64,9 +64,9 @@ lzo2a_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
#define LZO2A_999_MEM_COMPRESS ((lzo_uint32_t) (8 * 16384L * sizeof(short)))
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo2a_999_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
lzo2a_999_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
|
||||
|
||||
76
extern/lzo/include/lzo/lzo_asm.h
vendored
76
extern/lzo/include/lzo/lzo_asm.h
vendored
@@ -56,56 +56,56 @@ extern "C" {
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(int) lzo1c_decompress_asm
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int) lzo1c_decompress_asm_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
LZO_EXTERN(int) lzo1f_decompress_asm_fast
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int) lzo1f_decompress_asm_fast_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
LZO_EXTERN(int) lzo1x_decompress_asm
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int) lzo1x_decompress_asm_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int) lzo1x_decompress_asm_fast
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int) lzo1x_decompress_asm_fast_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
LZO_EXTERN(int) lzo1y_decompress_asm
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int) lzo1y_decompress_asm_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int) lzo1y_decompress_asm_fast
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_EXTERN(int) lzo1y_decompress_asm_fast_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -122,10 +122,10 @@ LZO_EXTERN(lzo_uint32_t)
|
||||
lzo_crc32_asm_small(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len);
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo_cpuid_asm(lzo_uint32_tp /* lzo_uint32_t info[16] */ );
|
||||
lzo_cpuid_asm(lzo_uint32_tp /* lzo_uint32_t info[16] */);
|
||||
|
||||
LZO_EXTERN(lzo_uint32_t)
|
||||
lzo_rdtsc_asm(lzo_uint32_tp /* lzo_uint32_t ticks[2] */ );
|
||||
lzo_rdtsc_asm(lzo_uint32_tp /* lzo_uint32_t ticks[2] */);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
107
extern/lzo/include/lzo/lzoconf.h
vendored
107
extern/lzo/include/lzo/lzoconf.h
vendored
@@ -92,12 +92,12 @@ extern "C" {
|
||||
#if !defined(LZO_UINT_MAX)
|
||||
# if (LZO_ABI_LLP64)
|
||||
# if (LZO_OS_WIN64)
|
||||
typedef unsigned __int64 lzo_uint;
|
||||
typedef __int64 lzo_int;
|
||||
typedef unsigned __int64 lzo_uint;
|
||||
typedef __int64 lzo_int;
|
||||
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF___INT64
|
||||
# else
|
||||
typedef lzo_ullong_t lzo_uint;
|
||||
typedef lzo_llong_t lzo_int;
|
||||
typedef lzo_ullong_t lzo_uint;
|
||||
typedef lzo_llong_t lzo_int;
|
||||
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG_LONG
|
||||
# endif
|
||||
# define LZO_SIZEOF_LZO_INT 8
|
||||
@@ -105,16 +105,16 @@ extern "C" {
|
||||
# define LZO_INT_MAX 9223372036854775807LL
|
||||
# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
|
||||
# elif (LZO_ABI_IP32L64) /* MIPS R5900 */
|
||||
typedef unsigned int lzo_uint;
|
||||
typedef int lzo_int;
|
||||
typedef unsigned int lzo_uint;
|
||||
typedef int lzo_int;
|
||||
# define LZO_SIZEOF_LZO_INT LZO_SIZEOF_INT
|
||||
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_INT
|
||||
# define LZO_UINT_MAX UINT_MAX
|
||||
# define LZO_INT_MAX INT_MAX
|
||||
# define LZO_INT_MIN INT_MIN
|
||||
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
||||
typedef unsigned long lzo_uint;
|
||||
typedef long lzo_int;
|
||||
typedef unsigned long lzo_uint;
|
||||
typedef long lzo_int;
|
||||
# define LZO_SIZEOF_LZO_INT LZO_SIZEOF_LONG
|
||||
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG
|
||||
# define LZO_UINT_MAX ULONG_MAX
|
||||
@@ -191,11 +191,11 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) >= 4)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(size_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(ptrdiff_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(lzo_uintptr_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_uintptr_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_uintptr_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long *) == sizeof(lzo_uintptr_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_voidp))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_bytep))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void*) == sizeof(lzo_uintptr_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char*) == sizeof(lzo_uintptr_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long*) == sizeof(lzo_uintptr_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void*) == sizeof(lzo_voidp))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char*) == sizeof(lzo_bytep))
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -237,31 +237,31 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_bytep))
|
||||
|
||||
/* function types */
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
(__LZO_CDECL* lzo_compress_t)(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
(__LZO_CDECL* lzo_decompress_t)(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
(__LZO_CDECL* lzo_optimize_t)(lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
(__LZO_CDECL* lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len);
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
(__LZO_CDECL* lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len);
|
||||
|
||||
|
||||
/* Callback interface. Currently only the progress indicator ("nprogress")
|
||||
@@ -272,14 +272,14 @@ typedef struct lzo_callback_t lzo_callback_t;
|
||||
#define lzo_callback_p lzo_callback_t __LZO_MMODEL *
|
||||
|
||||
/* malloc & free function types */
|
||||
typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
|
||||
(lzo_callback_p self, lzo_uint items, lzo_uint size);
|
||||
typedef void (__LZO_CDECL *lzo_free_func_t)
|
||||
(lzo_callback_p self, lzo_voidp ptr);
|
||||
typedef lzo_voidp(__LZO_CDECL* lzo_alloc_func_t)
|
||||
(lzo_callback_p self, lzo_uint items, lzo_uint size);
|
||||
typedef void (__LZO_CDECL* lzo_free_func_t)
|
||||
(lzo_callback_p self, lzo_voidp ptr);
|
||||
|
||||
/* a progress indicator callback function */
|
||||
typedef void (__LZO_CDECL *lzo_progress_func_t)
|
||||
(lzo_callback_p, lzo_uint, lzo_uint, int);
|
||||
typedef void (__LZO_CDECL* lzo_progress_func_t)
|
||||
(lzo_callback_p, lzo_uint, lzo_uint, int);
|
||||
|
||||
struct lzo_callback_t
|
||||
{
|
||||
@@ -337,38 +337,47 @@ struct lzo_callback_t
|
||||
(int)sizeof(long),(int)sizeof(lzo_uint32_t),(int)sizeof(lzo_uint),\
|
||||
(int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
|
||||
(int)sizeof(lzo_callback_t))
|
||||
LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
|
||||
LZO_EXTERN(int) __lzo_init_v2(unsigned, int, int, int, int, int, int, int, int, int);
|
||||
|
||||
/* version functions (useful for shared libraries) */
|
||||
LZO_EXTERN(unsigned) lzo_version(void);
|
||||
LZO_EXTERN(const char *) lzo_version_string(void);
|
||||
LZO_EXTERN(const char *) lzo_version_date(void);
|
||||
LZO_EXTERN(const char*) lzo_version_string(void);
|
||||
LZO_EXTERN(const char*) lzo_version_date(void);
|
||||
LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
|
||||
LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
|
||||
|
||||
/* string functions */
|
||||
LZO_EXTERN(int)
|
||||
lzo_memcmp(const lzo_voidp a, const lzo_voidp b, lzo_uint len);
|
||||
lzo_memcmp(const lzo_voidp a, const lzo_voidp b, lzo_uint len);
|
||||
LZO_EXTERN(lzo_voidp)
|
||||
lzo_memcpy(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
|
||||
lzo_memcpy(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
|
||||
LZO_EXTERN(lzo_voidp)
|
||||
lzo_memmove(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
|
||||
lzo_memmove(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
|
||||
LZO_EXTERN(lzo_voidp)
|
||||
lzo_memset(lzo_voidp buf, int c, lzo_uint len);
|
||||
lzo_memset(lzo_voidp buf, int c, lzo_uint len);
|
||||
|
||||
/* checksum functions */
|
||||
LZO_EXTERN(lzo_uint32_t)
|
||||
lzo_adler32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len);
|
||||
lzo_adler32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len);
|
||||
LZO_EXTERN(lzo_uint32_t)
|
||||
lzo_crc32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len);
|
||||
lzo_crc32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len);
|
||||
LZO_EXTERN(const lzo_uint32_tp)
|
||||
lzo_get_crc32_table(void);
|
||||
lzo_get_crc32_table(void);
|
||||
|
||||
/* misc. */
|
||||
LZO_EXTERN(int) _lzo_config_check(void);
|
||||
typedef union {
|
||||
lzo_voidp a00; lzo_bytep a01; lzo_uint a02; lzo_xint a03; lzo_uintptr_t a04;
|
||||
void *a05; unsigned char *a06; unsigned long a07; size_t a08; ptrdiff_t a09;
|
||||
typedef union
|
||||
{
|
||||
lzo_voidp a00;
|
||||
lzo_bytep a01;
|
||||
lzo_uint a02;
|
||||
lzo_xint a03;
|
||||
lzo_uintptr_t a04;
|
||||
void* a05;
|
||||
unsigned char* a06;
|
||||
unsigned long a07;
|
||||
size_t a08;
|
||||
ptrdiff_t a09;
|
||||
#if defined(lzo_int64_t)
|
||||
lzo_uint64_t a10;
|
||||
#endif
|
||||
|
||||
72
extern/lzo/include/lzo/lzodefs.h
vendored
72
extern/lzo/include/lzo/lzodefs.h
vendored
@@ -1114,21 +1114,21 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
#if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200))
|
||||
extern void __near __cdecl _AHSHIFT(void);
|
||||
extern void __near __cdecl _AHSHIFT(void);
|
||||
# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT)
|
||||
#elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC)
|
||||
extern void __near __cdecl _AHSHIFT(void);
|
||||
extern void __near __cdecl _AHSHIFT(void);
|
||||
# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT)
|
||||
#elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC)
|
||||
extern void __near __cdecl _AHSHIFT(void);
|
||||
extern void __near __cdecl _AHSHIFT(void);
|
||||
# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT)
|
||||
#elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295))
|
||||
extern void __near __cdecl _AHSHIFT(void);
|
||||
extern void __near __cdecl _AHSHIFT(void);
|
||||
# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT)
|
||||
#elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16)
|
||||
# define LZO_MM_AHSHIFT 12
|
||||
#elif (LZO_CC_WATCOMC)
|
||||
extern unsigned char _HShift;
|
||||
extern unsigned char _HShift;
|
||||
# define LZO_MM_AHSHIFT ((unsigned) _HShift)
|
||||
#else
|
||||
# error "FIXME - implement LZO_MM_AHSHIFT"
|
||||
@@ -2317,7 +2317,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8)
|
||||
#if !defined(LZO_SIZEOF_VOID_P)
|
||||
# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG
|
||||
#endif
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_VOID_P == sizeof(void *))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_VOID_P == sizeof(void*))
|
||||
#if !defined(LZO_SIZEOF_SIZE_T)
|
||||
#if (LZO_ARCH_I086 || LZO_ARCH_M16C)
|
||||
# define LZO_SIZEOF_SIZE_T 2
|
||||
@@ -2741,8 +2741,8 @@ __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
|
||||
# define lzo_uint16e_t unsigned short int
|
||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_SHORT
|
||||
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_HI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM)
|
||||
typedef int lzo_int16e_hi_t__ __attribute__((__mode__(__HI__)));
|
||||
typedef unsigned int lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__)));
|
||||
typedef int lzo_int16e_hi_t__ __attribute__((__mode__(__HI__)));
|
||||
typedef unsigned int lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__)));
|
||||
# define lzo_int16e_t lzo_int16e_hi_t__
|
||||
# define lzo_uint16e_t lzo_uint16e_hi_t__
|
||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___MODE_HI
|
||||
@@ -2755,8 +2755,8 @@ __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
|
||||
#endif
|
||||
#if defined(lzo_int16e_t)
|
||||
# define LZO_SIZEOF_LZO_INT16E_T 2
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == 2)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == LZO_SIZEOF_LZO_INT16E_T)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == 2)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == LZO_SIZEOF_LZO_INT16E_T)
|
||||
#endif
|
||||
#if !defined(lzo_int32e_t)
|
||||
#if (LZO_SIZEOF_LONG == 4)
|
||||
@@ -2776,14 +2776,14 @@ __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
|
||||
# define lzo_uint32e_t lzo_ullong_t
|
||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG_LONG
|
||||
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) && (__INT_MAX__+0 > 2147483647L)
|
||||
typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
# define lzo_int32e_t lzo_int32e_si_t__
|
||||
# define lzo_uint32e_t lzo_uint32e_si_t__
|
||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI
|
||||
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_GNUC >= 0x025f00ul) && defined(__AVR__) && (__LONG_MAX__+0 == 32767L)
|
||||
typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
# define lzo_int32e_t lzo_int32e_si_t__
|
||||
# define lzo_uint32e_t lzo_uint32e_si_t__
|
||||
# define LZO_INT32_C(c) (c##LL)
|
||||
@@ -2798,8 +2798,8 @@ __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
|
||||
#endif
|
||||
#if defined(lzo_int32e_t)
|
||||
# define LZO_SIZEOF_LZO_INT32E_T 4
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == 4)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == LZO_SIZEOF_LZO_INT32E_T)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == 4)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == LZO_SIZEOF_LZO_INT32E_T)
|
||||
#endif
|
||||
#if !defined(lzo_int64e_t)
|
||||
#if (LZO_SIZEOF___INT64 == 8)
|
||||
@@ -2845,8 +2845,8 @@ __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
|
||||
#endif
|
||||
#if defined(lzo_int64e_t)
|
||||
# define LZO_SIZEOF_LZO_INT64E_T 8
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == 8)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == LZO_SIZEOF_LZO_INT64E_T)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == 8)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == LZO_SIZEOF_LZO_INT64E_T)
|
||||
#endif
|
||||
#if !defined(lzo_int32l_t)
|
||||
#if defined(lzo_int32e_t)
|
||||
@@ -2869,8 +2869,8 @@ __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
|
||||
#endif
|
||||
#endif
|
||||
#if 1
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) >= 4)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) == LZO_SIZEOF_LZO_INT32L_T)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) >= 4)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) == LZO_SIZEOF_LZO_INT32L_T)
|
||||
#endif
|
||||
#if !defined(lzo_int64l_t)
|
||||
#if defined(lzo_int64e_t)
|
||||
@@ -2882,8 +2882,8 @@ __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
|
||||
#endif
|
||||
#endif
|
||||
#if defined(lzo_int64l_t)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) >= 8)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) == LZO_SIZEOF_LZO_INT64L_T)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) >= 8)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) == LZO_SIZEOF_LZO_INT64L_T)
|
||||
#endif
|
||||
#if !defined(lzo_int32f_t)
|
||||
#if (LZO_SIZEOF_SIZE_T >= 8)
|
||||
@@ -2899,8 +2899,8 @@ __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
|
||||
#endif
|
||||
#endif
|
||||
#if 1
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) >= 4)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) == LZO_SIZEOF_LZO_INT32F_T)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) >= 4)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) == LZO_SIZEOF_LZO_INT32F_T)
|
||||
#endif
|
||||
#if !defined(lzo_int64f_t)
|
||||
#if defined(lzo_int64l_t)
|
||||
@@ -2912,21 +2912,21 @@ __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
|
||||
#endif
|
||||
#endif
|
||||
#if defined(lzo_int64f_t)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) >= 8)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) == LZO_SIZEOF_LZO_INT64F_T)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) >= 8)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) == LZO_SIZEOF_LZO_INT64F_T)
|
||||
#endif
|
||||
#if !defined(lzo_intptr_t)
|
||||
#if 1 && (LZO_OS_OS400 && (LZO_SIZEOF_VOID_P == 16))
|
||||
# define __LZO_INTPTR_T_IS_POINTER 1
|
||||
typedef char * lzo_intptr_t;
|
||||
typedef char * lzo_uintptr_t;
|
||||
typedef char* lzo_intptr_t;
|
||||
typedef char* lzo_uintptr_t;
|
||||
# define lzo_intptr_t lzo_intptr_t
|
||||
# define lzo_uintptr_t lzo_uintptr_t
|
||||
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_VOID_P
|
||||
# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_CHAR_P
|
||||
#elif (LZO_CC_MSC && (_MSC_VER >= 1300) && (LZO_SIZEOF_VOID_P == 4) && (LZO_SIZEOF_INT == 4))
|
||||
typedef __w64 int lzo_intptr_t;
|
||||
typedef __w64 unsigned int lzo_uintptr_t;
|
||||
typedef __w64 int lzo_intptr_t;
|
||||
typedef __w64 unsigned int lzo_uintptr_t;
|
||||
# define lzo_intptr_t lzo_intptr_t
|
||||
# define lzo_uintptr_t lzo_uintptr_t
|
||||
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT
|
||||
@@ -2956,8 +2956,8 @@ __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
|
||||
#endif
|
||||
#endif
|
||||
#if 1
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) >= sizeof(void *))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) == sizeof(lzo_uintptr_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) >= sizeof(void*))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) == sizeof(lzo_uintptr_t))
|
||||
#endif
|
||||
#if !defined(lzo_word_t)
|
||||
#if defined(LZO_WORDSIZE) && (LZO_WORDSIZE+0 > 0)
|
||||
@@ -2993,8 +2993,8 @@ __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
|
||||
# define LZO_TYPEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T
|
||||
#elif (LZO_ARCH_SPU) && (LZO_CC_GNUC)
|
||||
#if 0
|
||||
typedef unsigned lzo_word_t __attribute__((__mode__(__V16QI__)));
|
||||
typedef int lzo_sword_t __attribute__((__mode__(__V16QI__)));
|
||||
typedef unsigned lzo_word_t __attribute__((__mode__(__V16QI__)));
|
||||
typedef int lzo_sword_t __attribute__((__mode__(__V16QI__)));
|
||||
# define lzo_word_t lzo_word_t
|
||||
# define lzo_sword_t lzo_sword_t
|
||||
# define LZO_SIZEOF_LZO_WORD_T 16
|
||||
@@ -3006,8 +3006,8 @@ __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
|
||||
#endif
|
||||
#endif
|
||||
#if 1 && defined(lzo_word_t)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_word_t) == LZO_WORDSIZE)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_sword_t) == LZO_WORDSIZE)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_word_t) == LZO_WORDSIZE)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_sword_t) == LZO_WORDSIZE)
|
||||
#endif
|
||||
#if 1
|
||||
#define lzo_int8_t signed char
|
||||
|
||||
78
extern/lzo/lzo.pri
vendored
78
extern/lzo/lzo.pri
vendored
@@ -1,78 +0,0 @@
|
||||
SOURCES += \
|
||||
$$PWD/src/lzo1.c \
|
||||
$$PWD/src/lzo1_99.c \
|
||||
$$PWD/src/lzo1a.c \
|
||||
$$PWD/src/lzo1a_99.c \
|
||||
$$PWD/src/lzo1b_1.c \
|
||||
$$PWD/src/lzo1b_2.c \
|
||||
$$PWD/src/lzo1b_3.c \
|
||||
$$PWD/src/lzo1b_4.c \
|
||||
$$PWD/src/lzo1b_5.c \
|
||||
$$PWD/src/lzo1b_6.c \
|
||||
$$PWD/src/lzo1b_7.c \
|
||||
$$PWD/src/lzo1b_8.c \
|
||||
$$PWD/src/lzo1b_9.c \
|
||||
$$PWD/src/lzo1b_99.c \
|
||||
$$PWD/src/lzo1b_9x.c \
|
||||
$$PWD/src/lzo1b_cc.c \
|
||||
$$PWD/src/lzo1b_d1.c \
|
||||
$$PWD/src/lzo1b_d2.c \
|
||||
$$PWD/src/lzo1b_rr.c \
|
||||
$$PWD/src/lzo1b_xx.c \
|
||||
$$PWD/src/lzo1c_1.c \
|
||||
$$PWD/src/lzo1c_2.c \
|
||||
$$PWD/src/lzo1c_3.c \
|
||||
$$PWD/src/lzo1c_4.c \
|
||||
$$PWD/src/lzo1c_5.c \
|
||||
$$PWD/src/lzo1c_6.c \
|
||||
$$PWD/src/lzo1c_7.c \
|
||||
$$PWD/src/lzo1c_8.c \
|
||||
$$PWD/src/lzo1c_9.c \
|
||||
$$PWD/src/lzo1c_99.c \
|
||||
$$PWD/src/lzo1c_9x.c \
|
||||
$$PWD/src/lzo1c_cc.c \
|
||||
$$PWD/src/lzo1c_d1.c \
|
||||
$$PWD/src/lzo1c_d2.c \
|
||||
$$PWD/src/lzo1c_rr.c \
|
||||
$$PWD/src/lzo1c_xx.c \
|
||||
$$PWD/src/lzo1f_1.c \
|
||||
$$PWD/src/lzo1f_9x.c \
|
||||
$$PWD/src/lzo1f_d1.c \
|
||||
$$PWD/src/lzo1f_d2.c \
|
||||
$$PWD/src/lzo1x_1.c \
|
||||
$$PWD/src/lzo1x_1k.c \
|
||||
$$PWD/src/lzo1x_1l.c \
|
||||
$$PWD/src/lzo1x_1o.c \
|
||||
$$PWD/src/lzo1x_9x.c \
|
||||
$$PWD/src/lzo1x_d1.c \
|
||||
$$PWD/src/lzo1x_d2.c \
|
||||
$$PWD/src/lzo1x_d3.c \
|
||||
$$PWD/src/lzo1x_o.c \
|
||||
$$PWD/src/lzo1y_1.c \
|
||||
$$PWD/src/lzo1y_9x.c \
|
||||
$$PWD/src/lzo1y_d1.c \
|
||||
$$PWD/src/lzo1y_d2.c \
|
||||
$$PWD/src/lzo1y_d3.c \
|
||||
$$PWD/src/lzo1y_o.c \
|
||||
$$PWD/src/lzo1z_9x.c \
|
||||
$$PWD/src/lzo1z_d1.c \
|
||||
$$PWD/src/lzo1z_d2.c \
|
||||
$$PWD/src/lzo1z_d3.c \
|
||||
$$PWD/src/lzo2a_9x.c \
|
||||
$$PWD/src/lzo2a_d1.c \
|
||||
$$PWD/src/lzo2a_d2.c \
|
||||
$$PWD/src/lzo_crc.c \
|
||||
$$PWD/src/lzo_init.c \
|
||||
$$PWD/src/lzo_ptr.c \
|
||||
$$PWD/src/lzo_str.c \
|
||||
$$PWD/src/lzo_util.c
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/include/lzo/lzo1.h \
|
||||
$$PWD/include/lzo/lzo1x.h \
|
||||
$$PWD/include/lzo/lzoconf.h \
|
||||
$$PWD/include/lzo/lzodefs.h \
|
||||
$$PWD/include/lzo/lzoutil.h
|
||||
|
||||
INCLUDEPATH += $$PWD/include
|
||||
|
||||
8
extern/lzo/src/compr1b.h
vendored
8
extern/lzo/src/compr1b.h
vendored
@@ -57,11 +57,11 @@
|
||||
const lzo_compress_t LZO_COMPRESS_FUNC = do_compress;
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
LZO_COMPRESS ( const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
LZO_COMPRESS(const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return _lzo1b_do_compress(in,in_len,out,out_len,wrkmem,do_compress);
|
||||
return _lzo1b_do_compress(in, in_len, out, out_len, wrkmem, do_compress);
|
||||
}
|
||||
|
||||
|
||||
|
||||
8
extern/lzo/src/compr1c.h
vendored
8
extern/lzo/src/compr1c.h
vendored
@@ -57,11 +57,11 @@
|
||||
const lzo_compress_t LZO_COMPRESS_FUNC = do_compress;
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
LZO_COMPRESS ( const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
LZO_COMPRESS(const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return _lzo1c_do_compress(in,in_len,out,out_len,wrkmem,do_compress);
|
||||
return _lzo1c_do_compress(in, in_len, out, out_len, wrkmem, do_compress);
|
||||
}
|
||||
|
||||
|
||||
|
||||
218
extern/lzo/src/lzo1.c
vendored
218
extern/lzo/src/lzo1.c
vendored
@@ -153,15 +153,17 @@ RBITS | MBITS MIN THR. MSIZE MAXS MINL MAXL MAXO R0MAX R0FAST
|
||||
// get algorithm info, return memory required for compression
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(lzo_uint) lzo1_info ( int *rbits, int *clevel );
|
||||
LZO_EXTERN(lzo_uint) lzo1_info(int* rbits, int* clevel);
|
||||
|
||||
LZO_PUBLIC(lzo_uint)
|
||||
lzo1_info ( int *rbits, int *clevel )
|
||||
lzo1_info(int* rbits, int* clevel)
|
||||
{
|
||||
if (rbits)
|
||||
*rbits = RBITS;
|
||||
|
||||
if (clevel)
|
||||
*clevel = CLEVEL;
|
||||
|
||||
return D_SIZE * lzo_sizeof(lzo_bytep);
|
||||
}
|
||||
|
||||
@@ -190,9 +192,9 @@ lzo1_info ( int *rbits, int *clevel )
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1_decompress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
lzo1_decompress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
lzo_bytep op;
|
||||
const lzo_bytep ip;
|
||||
@@ -203,6 +205,7 @@ lzo1_decompress ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
op = out;
|
||||
ip = in;
|
||||
|
||||
while (ip < ip_end)
|
||||
{
|
||||
t = *ip++; /* get marker */
|
||||
@@ -212,9 +215,11 @@ lzo1_decompress ( const lzo_bytep in , lzo_uint in_len,
|
||||
if (t == 0) /* a R0 literal run */
|
||||
{
|
||||
t = *ip++;
|
||||
|
||||
if (t >= R0FAST - R0MIN) /* a long R0 run */
|
||||
{
|
||||
t -= R0FAST - R0MIN;
|
||||
|
||||
if (t == 0)
|
||||
t = R0FAST;
|
||||
else
|
||||
@@ -224,23 +229,30 @@ lzo1_decompress ( const lzo_bytep in , lzo_uint in_len,
|
||||
#else
|
||||
/* help the optimizer */
|
||||
lzo_uint tt = 256;
|
||||
do tt <<= 1; while (--t > 0);
|
||||
|
||||
do tt <<= 1;
|
||||
|
||||
while (--t > 0);
|
||||
|
||||
t = tt;
|
||||
#endif
|
||||
}
|
||||
MEMCPY8_DS(op,ip,t);
|
||||
|
||||
MEMCPY8_DS(op, ip, t);
|
||||
continue;
|
||||
}
|
||||
|
||||
t += R0MIN;
|
||||
}
|
||||
MEMCPY_DS(op,ip,t);
|
||||
|
||||
MEMCPY_DS(op, ip, t);
|
||||
}
|
||||
else /* a match */
|
||||
{
|
||||
lzo_uint tt;
|
||||
/* get match offset */
|
||||
const lzo_bytep m_pos = op - 1;
|
||||
m_pos -= (lzo_uint)(t & OMASK) | (((lzo_uint) *ip++) << OBITS);
|
||||
m_pos -= (lzo_uint)(t & OMASK) | (((lzo_uint) * ip++) << OBITS);
|
||||
|
||||
/* get match len */
|
||||
if (t >= ((MSIZE - 1) << OBITS)) /* all m-bits set */
|
||||
@@ -253,7 +265,7 @@ lzo1_decompress ( const lzo_bytep in , lzo_uint in_len,
|
||||
/* a half unrolled loop */
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
MEMCPY_DS(op,m_pos,tt);
|
||||
MEMCPY_DS(op, m_pos, tt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +273,7 @@ lzo1_decompress ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
/* the next line is the only check in the decompressor ! */
|
||||
return (ip == ip_end ? LZO_E_OK :
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
}
|
||||
|
||||
|
||||
@@ -282,26 +294,33 @@ store_run(lzo_bytep op, const lzo_bytep ii, lzo_uint r_len)
|
||||
if (r_len >= 512)
|
||||
{
|
||||
unsigned r_bits = 7; /* 256 << 7 == 32768 */
|
||||
do {
|
||||
|
||||
do
|
||||
{
|
||||
while (r_len >= (256u << r_bits))
|
||||
{
|
||||
r_len -= (256u << r_bits);
|
||||
*op++ = 0; *op++ = LZO_BYTE((R0FAST - R0MIN) + r_bits);
|
||||
*op++ = 0;
|
||||
*op++ = LZO_BYTE((R0FAST - R0MIN) + r_bits);
|
||||
MEMCPY8_DS(op, ii, (256u << r_bits));
|
||||
}
|
||||
} while (--r_bits > 0);
|
||||
}
|
||||
while (--r_bits > 0);
|
||||
}
|
||||
|
||||
while (r_len >= R0FAST)
|
||||
{
|
||||
r_len -= R0FAST;
|
||||
*op++ = 0; *op++ = R0FAST - R0MIN;
|
||||
*op++ = 0;
|
||||
*op++ = R0FAST - R0MIN;
|
||||
MEMCPY8_DS(op, ii, R0FAST);
|
||||
}
|
||||
|
||||
if (r_len >= R0MIN)
|
||||
{
|
||||
/* code a short R0 run */
|
||||
*op++ = 0; *op++ = LZO_BYTE(r_len - R0MIN);
|
||||
*op++ = 0;
|
||||
*op++ = LZO_BYTE(r_len - R0MIN);
|
||||
MEMCPY_DS(op, ii, r_len);
|
||||
}
|
||||
else if (r_len > 0)
|
||||
@@ -326,9 +345,9 @@ store_run(lzo_bytep op, const lzo_bytep ii, lzo_uint r_len)
|
||||
************************************************************************/
|
||||
|
||||
static int
|
||||
do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
do_compress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
const lzo_bytep ip;
|
||||
#if defined(__LZO_HASH_INCREMENTAL)
|
||||
@@ -336,8 +355,8 @@ do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
#endif
|
||||
lzo_bytep op;
|
||||
const lzo_bytep m_pos;
|
||||
const lzo_bytep const ip_end = in+in_len - DVAL_LEN - MIN_MATCH_LONG;
|
||||
const lzo_bytep const in_end = in+in_len - DVAL_LEN;
|
||||
const lzo_bytep const ip_end = in + in_len - DVAL_LEN - MIN_MATCH_LONG;
|
||||
const lzo_bytep const in_end = in + in_len - DVAL_LEN;
|
||||
const lzo_bytep ii;
|
||||
lzo_dict_p const dict = (lzo_dict_p) wrkmem;
|
||||
|
||||
@@ -348,60 +367,72 @@ do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
op = out;
|
||||
ip = in;
|
||||
ii = ip; /* point to start of literal run */
|
||||
|
||||
if (in_len <= MIN_MATCH_LONG + DVAL_LEN + 1)
|
||||
goto the_end;
|
||||
|
||||
/* init dictionary */
|
||||
#if (LZO_DETERMINISTIC)
|
||||
BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE);
|
||||
BZERO8_PTR(wrkmem, sizeof(lzo_dict_t), D_SIZE);
|
||||
#endif
|
||||
|
||||
DVAL_FIRST(dv,ip);
|
||||
UPDATE_D(dict,0,dv,ip,in);
|
||||
DVAL_FIRST(dv, ip);
|
||||
UPDATE_D(dict, 0, dv, ip, in);
|
||||
ip++;
|
||||
DVAL_NEXT(dv,ip);
|
||||
DVAL_NEXT(dv, ip);
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0);
|
||||
lzo_uint dindex;
|
||||
|
||||
DINDEX1(dindex,ip);
|
||||
GINDEX(m_pos,m_off,dict,dindex,in);
|
||||
if (LZO_CHECK_MPOS(m_pos,m_off,in,ip,MAX_OFFSET))
|
||||
DINDEX1(dindex, ip);
|
||||
GINDEX(m_pos, m_off, dict, dindex, in);
|
||||
|
||||
if (LZO_CHECK_MPOS(m_pos, m_off, in, ip, MAX_OFFSET))
|
||||
goto literal;
|
||||
|
||||
if (m_pos[0] == ip[0] && m_pos[1] == ip[1] && m_pos[2] == ip[2])
|
||||
goto match;
|
||||
DINDEX2(dindex,ip);
|
||||
GINDEX(m_pos,m_off,dict,dindex,in);
|
||||
if (LZO_CHECK_MPOS(m_pos,m_off,in,ip,MAX_OFFSET))
|
||||
|
||||
DINDEX2(dindex, ip);
|
||||
GINDEX(m_pos, m_off, dict, dindex, in);
|
||||
|
||||
if (LZO_CHECK_MPOS(m_pos, m_off, in, ip, MAX_OFFSET))
|
||||
goto literal;
|
||||
|
||||
if (m_pos[0] == ip[0] && m_pos[1] == ip[1] && m_pos[2] == ip[2])
|
||||
goto match;
|
||||
|
||||
goto literal;
|
||||
|
||||
|
||||
literal:
|
||||
UPDATE_I(dict,0,dindex,ip,in);
|
||||
UPDATE_I(dict, 0, dindex, ip, in);
|
||||
|
||||
if (++ip >= ip_end)
|
||||
break;
|
||||
|
||||
continue;
|
||||
|
||||
match:
|
||||
UPDATE_I(dict,0,dindex,ip,in);
|
||||
UPDATE_I(dict, 0, dindex, ip, in);
|
||||
#if !defined(NDEBUG) && (LZO_DICT_USE_PTR)
|
||||
m_pos_sav = m_pos;
|
||||
#endif
|
||||
m_pos += 3;
|
||||
{
|
||||
/* we have found a match (of at least length 3) */
|
||||
/* we have found a match (of at least length 3) */
|
||||
#if !defined(NDEBUG) && !(LZO_DICT_USE_PTR)
|
||||
assert((m_pos_sav = ip - m_off) == (m_pos - 3));
|
||||
#endif
|
||||
|
||||
/* 1) store the current literal run */
|
||||
if (pd(ip,ii) > 0)
|
||||
if (pd(ip, ii) > 0)
|
||||
{
|
||||
lzo_uint t = pd(ip,ii);
|
||||
lzo_uint t = pd(ip, ii);
|
||||
#if 1
|
||||
|
||||
/* OPTIMIZED: inline the copying of a short run */
|
||||
if (t < R0MIN)
|
||||
{
|
||||
@@ -410,7 +441,7 @@ match:
|
||||
}
|
||||
else
|
||||
#endif
|
||||
op = store_run(op,ii,t);
|
||||
op = store_run(op, ii, t);
|
||||
}
|
||||
|
||||
/* 2a) compute match len */
|
||||
@@ -427,33 +458,34 @@ match:
|
||||
#define PS *m_pos++ != *ip++
|
||||
|
||||
#if (MIN_MATCH_LONG - MIN_MATCH == 2) /* MBITS == 2 */
|
||||
|
||||
if (PS || PS)
|
||||
#elif (MIN_MATCH_LONG - MIN_MATCH == 6) /* MBITS == 3 */
|
||||
if (PS || PS || PS || PS || PS || PS)
|
||||
#elif (MIN_MATCH_LONG - MIN_MATCH == 14) /* MBITS == 4 */
|
||||
if (PS || PS || PS || PS || PS || PS || PS ||
|
||||
PS || PS || PS || PS || PS || PS || PS)
|
||||
PS || PS || PS || PS || PS || PS || PS)
|
||||
#elif (MIN_MATCH_LONG - MIN_MATCH == 30) /* MBITS == 5 */
|
||||
if (PS || PS || PS || PS || PS || PS || PS || PS ||
|
||||
PS || PS || PS || PS || PS || PS || PS || PS ||
|
||||
PS || PS || PS || PS || PS || PS || PS || PS ||
|
||||
PS || PS || PS || PS || PS || PS)
|
||||
PS || PS || PS || PS || PS || PS || PS || PS ||
|
||||
PS || PS || PS || PS || PS || PS || PS || PS ||
|
||||
PS || PS || PS || PS || PS || PS)
|
||||
#else
|
||||
# error "MBITS not yet implemented"
|
||||
#endif
|
||||
{
|
||||
lzo_uint m_len;
|
||||
|
||||
/* 2b) code a short match */
|
||||
assert(pd(ip,m_pos) == m_off);
|
||||
/* 2b) code a short match */
|
||||
assert(pd(ip, m_pos) == m_off);
|
||||
--ip; /* ran one too far, point back to non-match */
|
||||
m_len = pd(ip, ii);
|
||||
assert(m_len >= MIN_MATCH_SHORT);
|
||||
assert(m_len <= MAX_MATCH_SHORT);
|
||||
assert(m_off > 0);
|
||||
assert(m_off <= MAX_OFFSET);
|
||||
assert(ii-m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav,ii,m_len) == 0);
|
||||
assert(m_len >= MIN_MATCH_SHORT);
|
||||
assert(m_len <= MAX_MATCH_SHORT);
|
||||
assert(m_off > 0);
|
||||
assert(m_off <= MAX_OFFSET);
|
||||
assert(ii - m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav, ii, m_len) == 0);
|
||||
--m_off;
|
||||
/* code short match len + low offset bits */
|
||||
*op++ = LZO_BYTE(((m_len - THRESHOLD) << OBITS) |
|
||||
@@ -462,41 +494,45 @@ match:
|
||||
*op++ = LZO_BYTE(m_off >> OBITS);
|
||||
|
||||
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
|
||||
#define SI /* nothing */
|
||||
#define DI ++ii; DVAL_NEXT(dv,ii); UPDATE_D(dict,0,dv,ii,in);
|
||||
#define XI assert(ii < ip); ii = ip; DVAL_FIRST(dv,(ip));
|
||||
|
||||
#if (CLEVEL == 9) || (CLEVEL >= 7 && MBITS <= 4) || (CLEVEL >= 5 && MBITS <= 3)
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
++ii;
|
||||
do {
|
||||
DVAL_NEXT(dv,ii);
|
||||
UPDATE_D(dict,0,dv,ii,in);
|
||||
} while (++ii < ip);
|
||||
DVAL_NEXT(dv,ii);
|
||||
|
||||
do
|
||||
{
|
||||
DVAL_NEXT(dv, ii);
|
||||
UPDATE_D(dict, 0, dv, ii, in);
|
||||
}
|
||||
while (++ii < ip);
|
||||
|
||||
DVAL_NEXT(dv, ii);
|
||||
assert(ii == ip);
|
||||
DVAL_ASSERT(dv,ip);
|
||||
DVAL_ASSERT(dv, ip);
|
||||
#elif (CLEVEL >= 3)
|
||||
SI DI DI XI
|
||||
#elif (CLEVEL >= 2)
|
||||
SI DI XI
|
||||
#else
|
||||
XI
|
||||
XI
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we've found a long match - see how far we can still go */
|
||||
/* we've found a long match - see how far we can still go */
|
||||
const lzo_bytep end;
|
||||
lzo_uint m_len;
|
||||
|
||||
assert(ip <= in_end);
|
||||
assert(ii == ip - MIN_MATCH_LONG);
|
||||
|
||||
if (pd(in_end,ip) <= (MAX_MATCH_LONG - MIN_MATCH_LONG))
|
||||
if (pd(in_end, ip) <= (MAX_MATCH_LONG - MIN_MATCH_LONG))
|
||||
end = in_end;
|
||||
else
|
||||
{
|
||||
@@ -506,17 +542,18 @@ match:
|
||||
|
||||
while (ip < end && *m_pos == *ip)
|
||||
m_pos++, ip++;
|
||||
|
||||
assert(ip <= in_end);
|
||||
|
||||
/* 2b) code the long match */
|
||||
/* 2b) code the long match */
|
||||
m_len = pd(ip, ii);
|
||||
assert(m_len >= MIN_MATCH_LONG);
|
||||
assert(m_len <= MAX_MATCH_LONG);
|
||||
assert(m_off > 0);
|
||||
assert(m_off <= MAX_OFFSET);
|
||||
assert(ii-m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav,ii,m_len) == 0);
|
||||
assert(pd(ip,m_pos) == m_off);
|
||||
assert(m_len >= MIN_MATCH_LONG);
|
||||
assert(m_len <= MAX_MATCH_LONG);
|
||||
assert(m_off > 0);
|
||||
assert(m_off <= MAX_OFFSET);
|
||||
assert(ii - m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav, ii, m_len) == 0);
|
||||
assert(pd(ip, m_pos) == m_off);
|
||||
--m_off;
|
||||
/* code long match flag + low offset bits */
|
||||
*op++ = LZO_BYTE(((MSIZE - 1) << OBITS) | (m_off & OMASK));
|
||||
@@ -526,18 +563,22 @@ match:
|
||||
*op++ = LZO_BYTE(m_len - MIN_MATCH_LONG);
|
||||
|
||||
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
#if (CLEVEL == 9)
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
/* This is not recommended because it is slow. */
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
/* This is not recommended because it is slow. */
|
||||
++ii;
|
||||
do {
|
||||
DVAL_NEXT(dv,ii);
|
||||
UPDATE_D(dict,0,dv,ii,in);
|
||||
} while (++ii < ip);
|
||||
DVAL_NEXT(dv,ii);
|
||||
|
||||
do
|
||||
{
|
||||
DVAL_NEXT(dv, ii);
|
||||
UPDATE_D(dict, 0, dv, ii, in);
|
||||
}
|
||||
while (++ii < ip);
|
||||
|
||||
DVAL_NEXT(dv, ii);
|
||||
assert(ii == ip);
|
||||
DVAL_ASSERT(dv,ip);
|
||||
DVAL_ASSERT(dv, ip);
|
||||
#elif (CLEVEL >= 8)
|
||||
SI DI DI DI DI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 7)
|
||||
@@ -553,14 +594,15 @@ match:
|
||||
#elif (CLEVEL >= 2)
|
||||
SI DI XI
|
||||
#else
|
||||
XI
|
||||
XI
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ii now points to the start of next literal run */
|
||||
assert(ii == ip);
|
||||
}
|
||||
} while (ip < ip_end);
|
||||
}
|
||||
while (ip < ip_end);
|
||||
|
||||
|
||||
|
||||
@@ -569,6 +611,7 @@ the_end:
|
||||
|
||||
|
||||
#if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE)
|
||||
|
||||
/* return -1 if op == out to indicate that we
|
||||
* couldn't compress and didn't copy anything.
|
||||
*/
|
||||
@@ -577,12 +620,13 @@ the_end:
|
||||
*out_len = 0;
|
||||
return LZO_E_NOT_COMPRESSIBLE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* store the final literal run */
|
||||
if (pd(in_end+DVAL_LEN,ii) > 0)
|
||||
op = store_run(op,ii,pd(in_end+DVAL_LEN,ii));
|
||||
if (pd(in_end + DVAL_LEN, ii) > 0)
|
||||
op = store_run(op, ii, pd(in_end + DVAL_LEN, ii));
|
||||
|
||||
*out_len = pd(op, out);
|
||||
return 0; /* compression went ok */
|
||||
@@ -594,9 +638,9 @@ the_end:
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
lzo1_compress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
int r = LZO_E_OK;
|
||||
|
||||
@@ -608,11 +652,11 @@ lzo1_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
#if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE)
|
||||
r = LZO_E_NOT_COMPRESSIBLE;
|
||||
#else
|
||||
*out_len = pd(store_run(out,in,in_len), out);
|
||||
*out_len = pd(store_run(out, in, in_len), out);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
r = do_compress(in,in_len,out,out_len,wrkmem);
|
||||
r = do_compress(in, in_len, out, out_len, wrkmem);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
20
extern/lzo/src/lzo1_99.c
vendored
20
extern/lzo/src/lzo1_99.c
vendored
@@ -46,10 +46,10 @@
|
||||
************************************************************************/
|
||||
|
||||
static int
|
||||
_lzo1_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_compress_t func )
|
||||
_lzo1_do_compress(const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_compress_t func)
|
||||
{
|
||||
int r;
|
||||
|
||||
@@ -65,12 +65,12 @@ _lzo1_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
*out_len = 0;
|
||||
r = LZO_E_NOT_COMPRESSIBLE;
|
||||
#else
|
||||
*out_len = pd(STORE_RUN(out,in,in_len), out);
|
||||
*out_len = pd(STORE_RUN(out, in, in_len), out);
|
||||
r = (*out_len > in_len) ? LZO_E_OK : LZO_E_ERROR;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
r = func(in,in_len,out,out_len,wrkmem);
|
||||
r = func(in, in_len, out, out_len, wrkmem);
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -105,11 +105,11 @@ _lzo1_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
LZO_COMPRESS ( const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
LZO_COMPRESS(const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return _lzo1_do_compress(in,in_len,out,out_len,wrkmem,do_compress);
|
||||
return _lzo1_do_compress(in, in_len, out, out_len, wrkmem, do_compress);
|
||||
}
|
||||
|
||||
|
||||
|
||||
2
extern/lzo/src/lzo1_d.ch
vendored
2
extern/lzo/src/lzo1_d.ch
vendored
@@ -105,7 +105,7 @@
|
||||
|
||||
|
||||
#if !defined(LZO_EOF_CODE) && !defined(TEST_IP)
|
||||
/* if we have no EOF code, we have to test for the end of the input */
|
||||
/* if we have no EOF code, we have to test for the end of the input */
|
||||
# define TEST_IP (ip < ip_end)
|
||||
#endif
|
||||
|
||||
|
||||
267
extern/lzo/src/lzo1a.c
vendored
267
extern/lzo/src/lzo1a.c
vendored
@@ -91,8 +91,8 @@
|
||||
|
||||
|
||||
#if (LZO_COLLECT_STATS)
|
||||
static lzo1a_stats_t lzo_statistics;
|
||||
lzo1a_stats_t *lzo1a_stats = &lzo_statistics;
|
||||
static lzo1a_stats_t lzo_statistics;
|
||||
lzo1a_stats_t* lzo1a_stats = &lzo_statistics;
|
||||
# define lzo_stats lzo1a_stats
|
||||
#endif
|
||||
|
||||
@@ -101,15 +101,17 @@
|
||||
// get algorithm info, return memory required for compression
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(lzo_uint) lzo1a_info ( int *rbits, int *clevel );
|
||||
LZO_EXTERN(lzo_uint) lzo1a_info(int* rbits, int* clevel);
|
||||
|
||||
LZO_PUBLIC(lzo_uint)
|
||||
lzo1a_info ( int *rbits, int *clevel )
|
||||
lzo1a_info(int* rbits, int* clevel)
|
||||
{
|
||||
if (rbits)
|
||||
*rbits = RBITS;
|
||||
|
||||
if (clevel)
|
||||
*clevel = CLEVEL;
|
||||
|
||||
return D_SIZE * lzo_sizeof(lzo_bytep);
|
||||
}
|
||||
|
||||
@@ -121,9 +123,9 @@ lzo1a_info ( int *rbits, int *clevel )
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1a_decompress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
lzo1a_decompress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
lzo_bytep op;
|
||||
const lzo_bytep ip;
|
||||
@@ -135,6 +137,7 @@ lzo1a_decompress ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
op = out;
|
||||
ip = in;
|
||||
|
||||
while (ip < ip_end)
|
||||
{
|
||||
t = *ip++; /* get marker */
|
||||
@@ -143,9 +146,11 @@ lzo1a_decompress ( const lzo_bytep in , lzo_uint in_len,
|
||||
if (t == 0) /* a R0 literal run */
|
||||
{
|
||||
t = *ip++;
|
||||
|
||||
if (t >= R0FAST - R0MIN) /* a long R0 run */
|
||||
{
|
||||
t -= R0FAST - R0MIN;
|
||||
|
||||
if (t == 0)
|
||||
t = R0FAST;
|
||||
else
|
||||
@@ -155,33 +160,41 @@ lzo1a_decompress ( const lzo_bytep in , lzo_uint in_len,
|
||||
#else
|
||||
/* help the optimizer */
|
||||
lzo_uint tt = 256;
|
||||
do tt <<= 1; while (--t > 0);
|
||||
|
||||
do tt <<= 1;
|
||||
|
||||
while (--t > 0);
|
||||
|
||||
t = tt;
|
||||
#endif
|
||||
}
|
||||
MEMCPY8_DS(op,ip,t);
|
||||
|
||||
MEMCPY8_DS(op, ip, t);
|
||||
continue;
|
||||
}
|
||||
|
||||
t += R0MIN;
|
||||
goto literal;
|
||||
}
|
||||
else if (t < R0MIN) /* a short literal run */
|
||||
{
|
||||
literal:
|
||||
MEMCPY_DS(op,ip,t);
|
||||
MEMCPY_DS(op, ip, t);
|
||||
|
||||
/* after a literal a match must follow */
|
||||
/* after a literal a match must follow */
|
||||
while (ip < ip_end)
|
||||
{
|
||||
t = *ip++; /* get R1 marker */
|
||||
|
||||
if (t >= R0MIN)
|
||||
goto match;
|
||||
|
||||
/* R1 match - a context sensitive 3 byte match + 1 byte literal */
|
||||
/* R1 match - a context sensitive 3 byte match + 1 byte literal */
|
||||
assert((t & OMASK) == t);
|
||||
m_pos = op - MIN_OFFSET;
|
||||
m_pos -= t | (((lzo_uint) *ip++) << OBITS);
|
||||
assert(m_pos >= out); assert(m_pos < op);
|
||||
m_pos -= t | (((lzo_uint) * ip++) << OBITS);
|
||||
assert(m_pos >= out);
|
||||
assert(m_pos < op);
|
||||
*op++ = m_pos[0];
|
||||
*op++ = m_pos[1];
|
||||
*op++ = m_pos[2];
|
||||
@@ -193,8 +206,9 @@ literal:
|
||||
match:
|
||||
/* get match offset */
|
||||
m_pos = op - MIN_OFFSET;
|
||||
m_pos -= (t & OMASK) | (((lzo_uint) *ip++) << OBITS);
|
||||
assert(m_pos >= out); assert(m_pos < op);
|
||||
m_pos -= (t & OMASK) | (((lzo_uint) * ip++) << OBITS);
|
||||
assert(m_pos >= out);
|
||||
assert(m_pos < op);
|
||||
|
||||
/* get match len */
|
||||
if (t < ((MSIZE - 1) << OBITS)) /* a short match */
|
||||
@@ -202,7 +216,7 @@ match:
|
||||
t >>= OBITS;
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
MEMCPY_DS(op,m_pos,t);
|
||||
MEMCPY_DS(op, m_pos, t);
|
||||
}
|
||||
else /* a long match */
|
||||
{
|
||||
@@ -213,13 +227,16 @@ match:
|
||||
#endif
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
MEMCPY_DS(op,m_pos,t);
|
||||
MEMCPY_DS(op, m_pos, t);
|
||||
#if (LBITS < 8)
|
||||
/* a very short literal following a long match */
|
||||
t = ip[-1] >> LBITS;
|
||||
|
||||
if (t) do
|
||||
*op++ = *ip++;
|
||||
while (--t);
|
||||
*op++ = *ip++;
|
||||
|
||||
while (--t);
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -229,7 +246,7 @@ match:
|
||||
|
||||
/* the next line is the only check in the decompressor */
|
||||
return (ip == ip_end ? LZO_E_OK :
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
}
|
||||
|
||||
|
||||
@@ -243,9 +260,9 @@ match:
|
||||
#include "lzo1a_cr.ch"
|
||||
|
||||
static int
|
||||
do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
do_compress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
const lzo_bytep ip;
|
||||
#if defined(__LZO_HASH_INCREMENTAL)
|
||||
@@ -253,8 +270,8 @@ do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
#endif
|
||||
const lzo_bytep m_pos;
|
||||
lzo_bytep op;
|
||||
const lzo_bytep const ip_end = in+in_len - DVAL_LEN - MIN_MATCH_LONG;
|
||||
const lzo_bytep const in_end = in+in_len - DVAL_LEN;
|
||||
const lzo_bytep const ip_end = in + in_len - DVAL_LEN - MIN_MATCH_LONG;
|
||||
const lzo_bytep const in_end = in + in_len - DVAL_LEN;
|
||||
const lzo_bytep ii;
|
||||
lzo_dict_p const dict = (lzo_dict_p) wrkmem;
|
||||
const lzo_bytep r1 = ip_end; /* pointer for R1 match (none yet) */
|
||||
@@ -272,45 +289,56 @@ do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
/* init dictionary */
|
||||
#if (LZO_DETERMINISTIC)
|
||||
BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE);
|
||||
BZERO8_PTR(wrkmem, sizeof(lzo_dict_t), D_SIZE);
|
||||
#endif
|
||||
|
||||
DVAL_FIRST(dv,ip); UPDATE_D(dict,0,dv,ip,in); ip++;
|
||||
DVAL_NEXT(dv,ip);
|
||||
DVAL_FIRST(dv, ip);
|
||||
UPDATE_D(dict, 0, dv, ip, in);
|
||||
ip++;
|
||||
DVAL_NEXT(dv, ip);
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0);
|
||||
lzo_uint dindex;
|
||||
|
||||
DINDEX1(dindex,ip);
|
||||
GINDEX(m_pos,m_off,dict,dindex,in);
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,MAX_OFFSET))
|
||||
DINDEX1(dindex, ip);
|
||||
GINDEX(m_pos, m_off, dict, dindex, in);
|
||||
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos, m_off, in, ip, MAX_OFFSET))
|
||||
goto literal;
|
||||
|
||||
if (m_pos[0] == ip[0] && m_pos[1] == ip[1] && m_pos[2] == ip[2])
|
||||
goto match;
|
||||
DINDEX2(dindex,ip);
|
||||
GINDEX(m_pos,m_off,dict,dindex,in);
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,MAX_OFFSET))
|
||||
|
||||
DINDEX2(dindex, ip);
|
||||
GINDEX(m_pos, m_off, dict, dindex, in);
|
||||
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos, m_off, in, ip, MAX_OFFSET))
|
||||
goto literal;
|
||||
|
||||
if (m_pos[0] == ip[0] && m_pos[1] == ip[1] && m_pos[2] == ip[2])
|
||||
goto match;
|
||||
|
||||
goto literal;
|
||||
|
||||
literal:
|
||||
UPDATE_I(dict,0,dindex,ip,in);
|
||||
UPDATE_I(dict, 0, dindex, ip, in);
|
||||
|
||||
if (++ip >= ip_end)
|
||||
break;
|
||||
|
||||
continue;
|
||||
|
||||
match:
|
||||
UPDATE_I(dict,0,dindex,ip,in);
|
||||
UPDATE_I(dict, 0, dindex, ip, in);
|
||||
#if !defined(NDEBUG) && (LZO_DICT_USE_PTR)
|
||||
assert(m_pos == NULL || m_pos >= in);
|
||||
m_pos_sav = m_pos;
|
||||
#endif
|
||||
m_pos += 3;
|
||||
{
|
||||
/* we have found a match (of at least length 3) */
|
||||
/* we have found a match (of at least length 3) */
|
||||
|
||||
#if !defined(NDEBUG) && !(LZO_DICT_USE_PTR)
|
||||
assert((m_pos_sav = ip - m_off) == (m_pos - 3));
|
||||
@@ -320,22 +348,22 @@ match:
|
||||
assert(ip < ip_end);
|
||||
|
||||
/* 1) store the current literal run */
|
||||
if (pd(ip,ii) > 0)
|
||||
if (pd(ip, ii) > 0)
|
||||
{
|
||||
lzo_uint t = pd(ip,ii);
|
||||
lzo_uint t = pd(ip, ii);
|
||||
|
||||
if (ip - r1 == MIN_MATCH + 1)
|
||||
{
|
||||
/* Code a context sensitive R1 match.
|
||||
* This is tricky and somewhat difficult to explain:
|
||||
* multiplex a literal run of length 1 into the previous
|
||||
* short match of length MIN_MATCH.
|
||||
* The key idea is:
|
||||
* - after a short run a match MUST follow
|
||||
* - therefore the value m = 000 in the mmmooooo marker is free
|
||||
* - use 000ooooo to indicate a MIN_MATCH match (this
|
||||
* is already coded) plus a 1 byte literal
|
||||
*/
|
||||
/* Code a context sensitive R1 match.
|
||||
* This is tricky and somewhat difficult to explain:
|
||||
* multiplex a literal run of length 1 into the previous
|
||||
* short match of length MIN_MATCH.
|
||||
* The key idea is:
|
||||
* - after a short run a match MUST follow
|
||||
* - therefore the value m = 000 in the mmmooooo marker is free
|
||||
* - use 000ooooo to indicate a MIN_MATCH match (this
|
||||
* is already coded) plus a 1 byte literal
|
||||
*/
|
||||
assert(t == 1);
|
||||
/* modify marker byte */
|
||||
assert((op[-2] >> OBITS) == (MIN_MATCH - THRESHOLD));
|
||||
@@ -350,11 +378,11 @@ match:
|
||||
{
|
||||
/* inline the copying of a short run */
|
||||
#if (LBITS < 8)
|
||||
if (t < (1 << (8-LBITS)) && ii - im >= MIN_MATCH_LONG)
|
||||
if (t < (1 << (8 - LBITS)) && ii - im >= MIN_MATCH_LONG)
|
||||
{
|
||||
/* Code a very short literal run into the
|
||||
* previous long match length byte.
|
||||
*/
|
||||
/* Code a very short literal run into the
|
||||
* previous long match length byte.
|
||||
*/
|
||||
LZO_STATS(lzo_stats->lit_runs_after_long_match++);
|
||||
LZO_STATS(lzo_stats->lit_run_after_long_match[t]++);
|
||||
assert(ii - im <= MAX_MATCH_LONG);
|
||||
@@ -376,13 +404,15 @@ match:
|
||||
{
|
||||
/* inline the copying of a short R0 run */
|
||||
LZO_STATS(lzo_stats->r0short_runs++);
|
||||
*op++ = 0; *op++ = LZO_BYTE(t - R0MIN);
|
||||
*op++ = 0;
|
||||
*op++ = LZO_BYTE(t - R0MIN);
|
||||
MEMCPY_DS(op, ii, t);
|
||||
r1 = ip; /* set new R1 pointer */
|
||||
}
|
||||
else
|
||||
op = store_run(op,ii,t);
|
||||
op = store_run(op, ii, t);
|
||||
}
|
||||
|
||||
#if (LBITS < 8)
|
||||
im = ip;
|
||||
#endif
|
||||
@@ -402,37 +432,38 @@ match:
|
||||
#define PS *m_pos++ != *ip++
|
||||
|
||||
#if (MIN_MATCH_LONG - MIN_MATCH == 2) /* MBITS == 2 */
|
||||
|
||||
if (PS || PS)
|
||||
#elif (MIN_MATCH_LONG - MIN_MATCH == 6) /* MBITS == 3 */
|
||||
if (PS || PS || PS || PS || PS || PS)
|
||||
#elif (MIN_MATCH_LONG - MIN_MATCH == 14) /* MBITS == 4 */
|
||||
if (PS || PS || PS || PS || PS || PS || PS ||
|
||||
PS || PS || PS || PS || PS || PS || PS)
|
||||
PS || PS || PS || PS || PS || PS || PS)
|
||||
#elif (MIN_MATCH_LONG - MIN_MATCH == 30) /* MBITS == 5 */
|
||||
if (PS || PS || PS || PS || PS || PS || PS || PS ||
|
||||
PS || PS || PS || PS || PS || PS || PS || PS ||
|
||||
PS || PS || PS || PS || PS || PS || PS || PS ||
|
||||
PS || PS || PS || PS || PS || PS)
|
||||
PS || PS || PS || PS || PS || PS || PS || PS ||
|
||||
PS || PS || PS || PS || PS || PS || PS || PS ||
|
||||
PS || PS || PS || PS || PS || PS)
|
||||
#else
|
||||
# error "MBITS not yet implemented"
|
||||
#endif
|
||||
{
|
||||
/* we've found a short match */
|
||||
/* we've found a short match */
|
||||
lzo_uint m_len;
|
||||
|
||||
/* 2a) compute match parameters */
|
||||
assert(ip-m_pos == (int)m_off);
|
||||
/* 2a) compute match parameters */
|
||||
assert(ip - m_pos == (int)m_off);
|
||||
--ip; /* ran one too far, point back to non-match */
|
||||
m_len = pd(ip, ii);
|
||||
assert(m_len >= MIN_MATCH_SHORT);
|
||||
assert(m_len <= MAX_MATCH_SHORT);
|
||||
assert(m_off >= MIN_OFFSET);
|
||||
assert(m_off <= MAX_OFFSET);
|
||||
assert(ii-m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav,ii,m_len) == 0);
|
||||
assert(m_len >= MIN_MATCH_SHORT);
|
||||
assert(m_len <= MAX_MATCH_SHORT);
|
||||
assert(m_off >= MIN_OFFSET);
|
||||
assert(m_off <= MAX_OFFSET);
|
||||
assert(ii - m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav, ii, m_len) == 0);
|
||||
m_off -= MIN_OFFSET;
|
||||
|
||||
/* 2b) code a short match */
|
||||
/* 2b) code a short match */
|
||||
/* code short match len + low offset bits */
|
||||
*op++ = LZO_BYTE(((m_len - THRESHOLD) << OBITS) |
|
||||
(m_off & OMASK));
|
||||
@@ -443,50 +474,58 @@ match:
|
||||
#if (LZO_COLLECT_STATS)
|
||||
lzo_stats->short_matches++;
|
||||
lzo_stats->short_match[m_len]++;
|
||||
|
||||
if (m_off < OSIZE)
|
||||
lzo_stats->short_match_offset_osize[m_len]++;
|
||||
|
||||
if (m_off < 256)
|
||||
lzo_stats->short_match_offset_256[m_len]++;
|
||||
|
||||
if (m_off < 1024)
|
||||
lzo_stats->short_match_offset_1024[m_len]++;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
|
||||
#define SI /* nothing */
|
||||
#define DI ++ii; DVAL_NEXT(dv,ii); UPDATE_D(dict,0,dv,ii,in);
|
||||
#define XI assert(ii < ip); ii = ip; DVAL_FIRST(dv,(ip));
|
||||
|
||||
#if (CLEVEL == 9) || (CLEVEL >= 7 && MBITS <= 4) || (CLEVEL >= 5 && MBITS <= 3)
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
++ii;
|
||||
do {
|
||||
DVAL_NEXT(dv,ii);
|
||||
UPDATE_D(dict,0,dv,ii,in);
|
||||
} while (++ii < ip);
|
||||
DVAL_NEXT(dv,ii);
|
||||
|
||||
do
|
||||
{
|
||||
DVAL_NEXT(dv, ii);
|
||||
UPDATE_D(dict, 0, dv, ii, in);
|
||||
}
|
||||
while (++ii < ip);
|
||||
|
||||
DVAL_NEXT(dv, ii);
|
||||
assert(ii == ip);
|
||||
DVAL_ASSERT(dv,ip);
|
||||
DVAL_ASSERT(dv, ip);
|
||||
#elif (CLEVEL >= 3)
|
||||
SI DI DI XI
|
||||
#elif (CLEVEL >= 2)
|
||||
SI DI XI
|
||||
#else
|
||||
XI
|
||||
XI
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we've found a long match - see how far we can still go */
|
||||
/* we've found a long match - see how far we can still go */
|
||||
const lzo_bytep end;
|
||||
lzo_uint m_len;
|
||||
|
||||
assert(ip <= in_end);
|
||||
assert(ii == ip - MIN_MATCH_LONG);
|
||||
|
||||
if (pd(in_end,ip) <= (MAX_MATCH_LONG - MIN_MATCH_LONG))
|
||||
if (pd(in_end, ip) <= (MAX_MATCH_LONG - MIN_MATCH_LONG))
|
||||
end = in_end;
|
||||
else
|
||||
{
|
||||
@@ -496,20 +535,21 @@ match:
|
||||
|
||||
while (ip < end && *m_pos == *ip)
|
||||
m_pos++, ip++;
|
||||
|
||||
assert(ip <= in_end);
|
||||
|
||||
/* 2a) compute match parameters */
|
||||
/* 2a) compute match parameters */
|
||||
m_len = pd(ip, ii);
|
||||
assert(m_len >= MIN_MATCH_LONG);
|
||||
assert(m_len <= MAX_MATCH_LONG);
|
||||
assert(m_off >= MIN_OFFSET);
|
||||
assert(m_off <= MAX_OFFSET);
|
||||
assert(ii-m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav,ii,m_len) == 0);
|
||||
assert(pd(ip,m_pos) == m_off);
|
||||
assert(m_len >= MIN_MATCH_LONG);
|
||||
assert(m_len <= MAX_MATCH_LONG);
|
||||
assert(m_off >= MIN_OFFSET);
|
||||
assert(m_off <= MAX_OFFSET);
|
||||
assert(ii - m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav, ii, m_len) == 0);
|
||||
assert(pd(ip, m_pos) == m_off);
|
||||
m_off -= MIN_OFFSET;
|
||||
|
||||
/* 2b) code the long match */
|
||||
/* 2b) code the long match */
|
||||
/* code long match flag + low offset bits */
|
||||
*op++ = LZO_BYTE(((MSIZE - 1) << OBITS) | (m_off & OMASK));
|
||||
/* code high offset bits */
|
||||
@@ -524,18 +564,22 @@ match:
|
||||
#endif
|
||||
|
||||
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
#if (CLEVEL == 9)
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
/* This is not recommended because it is slow. */
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
/* This is not recommended because it is slow. */
|
||||
++ii;
|
||||
do {
|
||||
DVAL_NEXT(dv,ii);
|
||||
UPDATE_D(dict,0,dv,ii,in);
|
||||
} while (++ii < ip);
|
||||
DVAL_NEXT(dv,ii);
|
||||
|
||||
do
|
||||
{
|
||||
DVAL_NEXT(dv, ii);
|
||||
UPDATE_D(dict, 0, dv, ii, in);
|
||||
}
|
||||
while (++ii < ip);
|
||||
|
||||
DVAL_NEXT(dv, ii);
|
||||
assert(ii == ip);
|
||||
DVAL_ASSERT(dv,ip);
|
||||
DVAL_ASSERT(dv, ip);
|
||||
#elif (CLEVEL >= 8)
|
||||
SI DI DI DI DI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 7)
|
||||
@@ -551,7 +595,7 @@ match:
|
||||
#elif (CLEVEL >= 2)
|
||||
SI DI XI
|
||||
#else
|
||||
XI
|
||||
XI
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -559,12 +603,14 @@ match:
|
||||
assert(ii == ip);
|
||||
}
|
||||
|
||||
} while (ip < ip_end);
|
||||
}
|
||||
while (ip < ip_end);
|
||||
|
||||
assert(ip <= in_end);
|
||||
|
||||
|
||||
#if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE)
|
||||
|
||||
/* return -1 if op == out to indicate that we
|
||||
* couldn't compress and didn't copy anything.
|
||||
*/
|
||||
@@ -573,11 +619,12 @@ match:
|
||||
*out_len = 0;
|
||||
return LZO_E_NOT_COMPRESSIBLE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* store the final literal run */
|
||||
if (pd(in_end+DVAL_LEN,ii) > 0)
|
||||
op = store_run(op,ii,pd(in_end+DVAL_LEN,ii));
|
||||
if (pd(in_end + DVAL_LEN, ii) > 0)
|
||||
op = store_run(op, ii, pd(in_end + DVAL_LEN, ii));
|
||||
|
||||
*out_len = pd(op, out);
|
||||
return 0; /* compression went ok */
|
||||
@@ -589,15 +636,15 @@ match:
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1a_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
lzo1a_compress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
int r = LZO_E_OK;
|
||||
|
||||
|
||||
#if (LZO_COLLECT_STATS)
|
||||
lzo_memset(lzo_stats,0,sizeof(*lzo_stats));
|
||||
lzo_memset(lzo_stats, 0, sizeof(*lzo_stats));
|
||||
lzo_stats->rbits = RBITS;
|
||||
lzo_stats->clevel = CLEVEL;
|
||||
lzo_stats->dbits = DBITS;
|
||||
@@ -623,11 +670,11 @@ lzo1a_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
#if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE)
|
||||
r = LZO_E_NOT_COMPRESSIBLE;
|
||||
#else
|
||||
*out_len = pd(store_run(out,in,in_len), out);
|
||||
*out_len = pd(store_run(out, in, in_len), out);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
r = do_compress(in,in_len,out,out_len,wrkmem);
|
||||
r = do_compress(in, in_len, out, out_len, wrkmem);
|
||||
|
||||
|
||||
#if (LZO_COLLECT_STATS)
|
||||
|
||||
20
extern/lzo/src/lzo1a_99.c
vendored
20
extern/lzo/src/lzo1a_99.c
vendored
@@ -46,10 +46,10 @@
|
||||
************************************************************************/
|
||||
|
||||
static int
|
||||
_lzo1a_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_compress_t func )
|
||||
_lzo1a_do_compress(const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_compress_t func)
|
||||
{
|
||||
int r;
|
||||
|
||||
@@ -65,12 +65,12 @@ _lzo1a_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
*out_len = 0;
|
||||
r = LZO_E_NOT_COMPRESSIBLE;
|
||||
#else
|
||||
*out_len = pd(STORE_RUN(out,in,in_len), out);
|
||||
*out_len = pd(STORE_RUN(out, in, in_len), out);
|
||||
r = (*out_len > in_len) ? LZO_E_OK : LZO_E_ERROR;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
r = func(in,in_len,out,out_len,wrkmem);
|
||||
r = func(in, in_len, out, out_len, wrkmem);
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -105,11 +105,11 @@ _lzo1a_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
LZO_COMPRESS ( const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
LZO_COMPRESS(const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return _lzo1a_do_compress(in,in_len,out,out_len,wrkmem,do_compress);
|
||||
return _lzo1a_do_compress(in, in_len, out, out_len, wrkmem, do_compress);
|
||||
}
|
||||
|
||||
|
||||
|
||||
269
extern/lzo/src/lzo1a_cm.ch
vendored
269
extern/lzo/src/lzo1a_cm.ch
vendored
@@ -47,182 +47,191 @@
|
||||
|
||||
#if (DD_BITS == 0)
|
||||
|
||||
/* we already matched M2_MIN_LEN bytes,
|
||||
* m_pos also already advanced M2_MIN_LEN bytes */
|
||||
ip += M2_MIN_LEN;
|
||||
assert(m_pos < ip);
|
||||
/* we already matched M2_MIN_LEN bytes,
|
||||
* m_pos also already advanced M2_MIN_LEN bytes */
|
||||
ip += M2_MIN_LEN;
|
||||
assert(m_pos < ip);
|
||||
|
||||
/* try to match another M2_MAX_LEN + 1 - M2_MIN_LEN bytes
|
||||
* to see if we get more than a M2 match */
|
||||
/* try to match another M2_MAX_LEN + 1 - M2_MIN_LEN bytes
|
||||
* to see if we get more than a M2 match */
|
||||
#define M2_OR_M3 (MATCH_M2)
|
||||
|
||||
#else /* (DD_BITS == 0) */
|
||||
|
||||
/* we already matched m_len bytes */
|
||||
assert(m_len >= M2_MIN_LEN);
|
||||
ip += m_len;
|
||||
assert(ip <= in_end);
|
||||
/* we already matched m_len bytes */
|
||||
assert(m_len >= M2_MIN_LEN);
|
||||
ip += m_len;
|
||||
assert(ip <= in_end);
|
||||
|
||||
#define M2_OR_M3 (m_len <= M2_MAX_LEN)
|
||||
|
||||
#endif /* (DD_BITS == 0) */
|
||||
|
||||
|
||||
if (M2_OR_M3)
|
||||
{
|
||||
/* we've found a short match */
|
||||
assert(ip <= in_end);
|
||||
if (M2_OR_M3)
|
||||
{
|
||||
/* we've found a short match */
|
||||
assert(ip <= in_end);
|
||||
|
||||
/* 2a) compute match parameters */
|
||||
/* 2a) compute match parameters */
|
||||
#if (DD_BITS == 0)
|
||||
assert(pd(ip,m_pos) == m_off);
|
||||
--ip; /* ran one too far, point back to non-match */
|
||||
m_len = ip - ii;
|
||||
assert(pd(ip, m_pos) == m_off);
|
||||
--ip; /* ran one too far, point back to non-match */
|
||||
m_len = ip - ii;
|
||||
#endif
|
||||
assert(m_len >= M2_MIN_LEN);
|
||||
assert(m_len <= M2_MAX_LEN);
|
||||
assert(m_len >= M2_MIN_LEN);
|
||||
assert(m_len <= M2_MAX_LEN);
|
||||
|
||||
assert(m_off >= M2_MIN_OFFSET);
|
||||
assert(m_off <= M2_MAX_OFFSET);
|
||||
assert(ii-m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav,ii,m_len) == 0);
|
||||
assert(m_off >= M2_MIN_OFFSET);
|
||||
assert(m_off <= M2_MAX_OFFSET);
|
||||
assert(ii - m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav, ii, m_len) == 0);
|
||||
|
||||
/* 2b) code the match */
|
||||
m_off -= M2_MIN_OFFSET;
|
||||
/* code short match len + low offset bits */
|
||||
*op++ = LZO_BYTE(((m_len - THRESHOLD) << M2O_BITS) |
|
||||
(m_off & M2O_MASK));
|
||||
/* code high offset bits */
|
||||
*op++ = LZO_BYTE(m_off >> M2O_BITS);
|
||||
/* 2b) code the match */
|
||||
m_off -= M2_MIN_OFFSET;
|
||||
/* code short match len + low offset bits */
|
||||
*op++ = LZO_BYTE(((m_len - THRESHOLD) << M2O_BITS) |
|
||||
(m_off & M2O_MASK));
|
||||
/* code high offset bits */
|
||||
*op++ = LZO_BYTE(m_off >> M2O_BITS);
|
||||
|
||||
|
||||
if (ip >= ip_end)
|
||||
{
|
||||
ii = ip;
|
||||
break;
|
||||
}
|
||||
if (ip >= ip_end)
|
||||
{
|
||||
ii = ip;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
|
||||
#if (CLEVEL == 9) || (CLEVEL >= 7 && M2L_BITS <= 4) || (CLEVEL >= 5 && M2L_BITS <= 3)
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
++ii;
|
||||
do {
|
||||
DVAL_NEXT(dv,ii);
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
++ii;
|
||||
|
||||
do
|
||||
{
|
||||
DVAL_NEXT(dv, ii);
|
||||
#if 0
|
||||
UPDATE_D(dict,drun,dv,ii,in);
|
||||
UPDATE_D(dict, drun, dv, ii, in);
|
||||
#else
|
||||
dict[ DINDEX(dv,ii) ] = DENTRY(ii,in);
|
||||
dict[ DINDEX(dv, ii) ] = DENTRY(ii, in);
|
||||
#endif
|
||||
MI
|
||||
} while (++ii < ip);
|
||||
DVAL_NEXT(dv,ii);
|
||||
assert(ii == ip);
|
||||
DVAL_ASSERT(dv,ip);
|
||||
MI
|
||||
}
|
||||
while (++ii < ip);
|
||||
|
||||
DVAL_NEXT(dv, ii);
|
||||
assert(ii == ip);
|
||||
DVAL_ASSERT(dv, ip);
|
||||
#elif (CLEVEL >= 3)
|
||||
SI DI DI XI
|
||||
SI DI DI XI
|
||||
#elif (CLEVEL >= 2)
|
||||
SI DI XI
|
||||
SI DI XI
|
||||
#else
|
||||
XI
|
||||
XI
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
else
|
||||
|
||||
{
|
||||
/* we've found a long match - see how far we can still go */
|
||||
const lzo_bytep end;
|
||||
{
|
||||
/* we've found a long match - see how far we can still go */
|
||||
const lzo_bytep end;
|
||||
|
||||
assert(ip <= in_end);
|
||||
assert(ii == ip - (M2_MAX_LEN + 1));
|
||||
assert(lzo_memcmp(m_pos_sav,ii,(lzo_uint)(ip-ii)) == 0);
|
||||
assert(ip <= in_end);
|
||||
assert(ii == ip - (M2_MAX_LEN + 1));
|
||||
assert(lzo_memcmp(m_pos_sav, ii, (lzo_uint)(ip - ii)) == 0);
|
||||
|
||||
#if (DD_BITS > 0)
|
||||
assert(m_len == (lzo_uint)(ip-ii));
|
||||
m_pos = ip - m_off;
|
||||
assert(m_pos == m_pos_sav + m_len);
|
||||
assert(m_len == (lzo_uint)(ip - ii));
|
||||
m_pos = ip - m_off;
|
||||
assert(m_pos == m_pos_sav + m_len);
|
||||
#endif
|
||||
|
||||
if (pd(in_end,ip) <= (M3_MAX_LEN - M3_MIN_LEN))
|
||||
end = in_end;
|
||||
else
|
||||
{
|
||||
end = ip + (M3_MAX_LEN - M3_MIN_LEN);
|
||||
assert(end < in_end);
|
||||
}
|
||||
if (pd(in_end, ip) <= (M3_MAX_LEN - M3_MIN_LEN))
|
||||
end = in_end;
|
||||
else
|
||||
{
|
||||
end = ip + (M3_MAX_LEN - M3_MIN_LEN);
|
||||
assert(end < in_end);
|
||||
}
|
||||
|
||||
while (ip < end && *m_pos == *ip)
|
||||
m_pos++, ip++;
|
||||
assert(ip <= in_end);
|
||||
while (ip < end && *m_pos == *ip)
|
||||
m_pos++, ip++;
|
||||
|
||||
/* 2a) compute match parameters */
|
||||
m_len = pd(ip, ii);
|
||||
assert(m_len >= M3_MIN_LEN);
|
||||
assert(m_len <= M3_MAX_LEN);
|
||||
assert(ip <= in_end);
|
||||
|
||||
assert(m_off >= M3_MIN_OFFSET);
|
||||
assert(m_off <= M3_MAX_OFFSET);
|
||||
assert(ii-m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav,ii,m_len) == 0);
|
||||
assert(pd(ip,m_pos) == m_off);
|
||||
/* 2a) compute match parameters */
|
||||
m_len = pd(ip, ii);
|
||||
assert(m_len >= M3_MIN_LEN);
|
||||
assert(m_len <= M3_MAX_LEN);
|
||||
|
||||
/* 2b) code the match */
|
||||
m_off -= M3_MIN_OFFSET - M3_EOF_OFFSET;
|
||||
/* code long match flag + low offset bits */
|
||||
*op++ = LZO_BYTE(((MSIZE - 1) << M3O_BITS) | (m_off & M3O_MASK));
|
||||
/* code high offset bits */
|
||||
*op++ = LZO_BYTE(m_off >> M3O_BITS);
|
||||
/* code match len */
|
||||
*op++ = LZO_BYTE(m_len - M3_MIN_LEN);
|
||||
assert(m_off >= M3_MIN_OFFSET);
|
||||
assert(m_off <= M3_MAX_OFFSET);
|
||||
assert(ii - m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav, ii, m_len) == 0);
|
||||
assert(pd(ip, m_pos) == m_off);
|
||||
|
||||
/* 2b) code the match */
|
||||
m_off -= M3_MIN_OFFSET - M3_EOF_OFFSET;
|
||||
/* code long match flag + low offset bits */
|
||||
*op++ = LZO_BYTE(((MSIZE - 1) << M3O_BITS) | (m_off & M3O_MASK));
|
||||
/* code high offset bits */
|
||||
*op++ = LZO_BYTE(m_off >> M3O_BITS);
|
||||
/* code match len */
|
||||
*op++ = LZO_BYTE(m_len - M3_MIN_LEN);
|
||||
|
||||
|
||||
if (ip >= ip_end)
|
||||
{
|
||||
ii = ip;
|
||||
break;
|
||||
}
|
||||
if (ip >= ip_end)
|
||||
{
|
||||
ii = ip;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
#if (CLEVEL == 9)
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
/* This is not recommended because it can be slow. */
|
||||
++ii;
|
||||
do {
|
||||
DVAL_NEXT(dv,ii);
|
||||
#if 0
|
||||
UPDATE_D(dict,drun,dv,ii,in);
|
||||
#else
|
||||
dict[ DINDEX(dv,ii) ] = DENTRY(ii,in);
|
||||
#endif
|
||||
MI
|
||||
} while (++ii < ip);
|
||||
DVAL_NEXT(dv,ii);
|
||||
assert(ii == ip);
|
||||
DVAL_ASSERT(dv,ip);
|
||||
#elif (CLEVEL >= 8)
|
||||
SI DI DI DI DI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 7)
|
||||
SI DI DI DI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 6)
|
||||
SI DI DI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 5)
|
||||
SI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 4)
|
||||
SI DI DI DI XI
|
||||
#elif (CLEVEL >= 3)
|
||||
SI DI DI XI
|
||||
#elif (CLEVEL >= 2)
|
||||
SI DI XI
|
||||
#else
|
||||
XI
|
||||
#endif
|
||||
}
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
/* This is not recommended because it can be slow. */
|
||||
++ii;
|
||||
|
||||
/* ii now points to the start of the next literal run */
|
||||
assert(ii == ip);
|
||||
do
|
||||
{
|
||||
DVAL_NEXT(dv, ii);
|
||||
#if 0
|
||||
UPDATE_D(dict, drun, dv, ii, in);
|
||||
#else
|
||||
dict[ DINDEX(dv, ii) ] = DENTRY(ii, in);
|
||||
#endif
|
||||
MI
|
||||
}
|
||||
while (++ii < ip);
|
||||
|
||||
DVAL_NEXT(dv, ii);
|
||||
assert(ii == ip);
|
||||
DVAL_ASSERT(dv, ip);
|
||||
#elif (CLEVEL >= 8)
|
||||
SI DI DI DI DI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 7)
|
||||
SI DI DI DI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 6)
|
||||
SI DI DI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 5)
|
||||
SI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 4)
|
||||
SI DI DI DI XI
|
||||
#elif (CLEVEL >= 3)
|
||||
SI DI DI XI
|
||||
#elif (CLEVEL >= 2)
|
||||
SI DI XI
|
||||
#else
|
||||
XI
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ii now points to the start of the next literal run */
|
||||
assert(ii == ip);
|
||||
|
||||
|
||||
/* vim:set ts=4 sw=4 et: */
|
||||
|
||||
23
extern/lzo/src/lzo1a_cr.ch
vendored
23
extern/lzo/src/lzo1a_cr.ch
vendored
@@ -60,37 +60,48 @@ store_run(lzo_bytep const oo, const lzo_bytep const ii, lzo_uint r_len)
|
||||
while (r_len >= (t = tt))
|
||||
{
|
||||
r_len -= t;
|
||||
*op++ = 0; *op++ = (R0MAX - R0MIN);
|
||||
*op++ = 0;
|
||||
*op++ = (R0MAX - R0MIN);
|
||||
MEMCPY8_DS(op, ip, t);
|
||||
LZO_STATS(lzo_stats->r0long_runs++);
|
||||
}
|
||||
|
||||
tt >>= 1;
|
||||
do {
|
||||
|
||||
do
|
||||
{
|
||||
if (r_len >= (t = tt))
|
||||
{
|
||||
r_len -= t;
|
||||
*op++ = 0; *op++ = LZO_BYTE((R0FAST - R0MIN) + r_bits);
|
||||
*op++ = 0;
|
||||
*op++ = LZO_BYTE((R0FAST - R0MIN) + r_bits);
|
||||
MEMCPY8_DS(op, ip, t);
|
||||
LZO_STATS(lzo_stats->r0long_runs++);
|
||||
}
|
||||
|
||||
tt >>= 1;
|
||||
} while (--r_bits > 0);
|
||||
}
|
||||
while (--r_bits > 0);
|
||||
}
|
||||
|
||||
assert(r_len < 512);
|
||||
|
||||
while (r_len >= (t = R0FAST))
|
||||
{
|
||||
r_len -= t;
|
||||
*op++ = 0; *op++ = (R0FAST - R0MIN);
|
||||
*op++ = 0;
|
||||
*op++ = (R0FAST - R0MIN);
|
||||
MEMCPY8_DS(op, ip, t);
|
||||
LZO_STATS(lzo_stats->r0fast_runs++);
|
||||
}
|
||||
|
||||
t = r_len;
|
||||
|
||||
if (t >= R0MIN)
|
||||
{
|
||||
/* code a short R0 run */
|
||||
*op++ = 0; *op++ = LZO_BYTE(t - R0MIN);
|
||||
*op++ = 0;
|
||||
*op++ = LZO_BYTE(t - R0MIN);
|
||||
MEMCPY_DS(op, ip, t);
|
||||
LZO_STATS(lzo_stats->r0short_runs++);
|
||||
}
|
||||
|
||||
91
extern/lzo/src/lzo1b_9x.c
vendored
91
extern/lzo/src/lzo1b_9x.c
vendored
@@ -50,7 +50,7 @@
|
||||
************************************************************************/
|
||||
|
||||
static lzo_bytep
|
||||
code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
code_match(LZO_COMPRESS_T* c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off)
|
||||
{
|
||||
if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET)
|
||||
{
|
||||
@@ -60,7 +60,7 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
m_off -= M2_MIN_OFFSET;
|
||||
/* code match len + low offset bits */
|
||||
*op++ = LZO_BYTE(((m_len - (M2_MIN_LEN - 2)) << M2O_BITS) |
|
||||
(m_off & M2O_MASK));
|
||||
(m_off & M2O_MASK));
|
||||
/* code high offset bits */
|
||||
*op++ = LZO_BYTE(m_off >> M2O_BITS);
|
||||
c->m2_m++;
|
||||
@@ -71,6 +71,7 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
assert(m_off <= M3_MAX_OFFSET);
|
||||
|
||||
m_off -= M3_MIN_OFFSET - M3_EOF_OFFSET;
|
||||
|
||||
/* code match len */
|
||||
if (m_len <= M3_MAX_LEN)
|
||||
*op++ = LZO_BYTE(M3_MARKER | (m_len - (M3_MIN_LEN - 1)));
|
||||
@@ -81,14 +82,17 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
*op++ = M4_MARKER;
|
||||
/* code match len */
|
||||
m_len -= M4_MIN_LEN - 1;
|
||||
|
||||
while (m_len > 255)
|
||||
{
|
||||
m_len -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
|
||||
assert(m_len > 0);
|
||||
*op++ = LZO_BYTE(m_len);
|
||||
}
|
||||
|
||||
/* code low offset bits */
|
||||
*op++ = LZO_BYTE(m_off & M3O_MASK);
|
||||
/* code high offset bits */
|
||||
@@ -97,6 +101,7 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
c->r1_m_len = 0;
|
||||
c->m3_m++;
|
||||
}
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
@@ -106,25 +111,25 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1b_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain );
|
||||
lzo1b_999_compress_callback(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain);
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1b_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain )
|
||||
lzo1b_999_compress_callback(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain)
|
||||
{
|
||||
lzo_bytep op;
|
||||
const lzo_bytep ii;
|
||||
lzo_uint lit;
|
||||
lzo_uint m_len, m_off;
|
||||
LZO_COMPRESS_T cc;
|
||||
LZO_COMPRESS_T * const c = &cc;
|
||||
LZO_COMPRESS_T* const c = &cc;
|
||||
lzo_swd_p const swd = (lzo_swd_p) wrkmem;
|
||||
int r;
|
||||
|
||||
@@ -142,15 +147,19 @@ lzo1b_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
lit = 0;
|
||||
c->r1_m_len = 0;
|
||||
|
||||
r = init_match(c,swd,NULL,0,0);
|
||||
r = init_match(c, swd, NULL, 0, 0);
|
||||
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
if (max_chain > 0)
|
||||
swd->max_chain = max_chain;
|
||||
|
||||
r = find_match(c,swd,0,0);
|
||||
r = find_match(c, swd, 0, 0);
|
||||
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
while (c->look > 0)
|
||||
{
|
||||
int lazy_match_min_gain = -1;
|
||||
@@ -160,18 +169,20 @@ lzo1b_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
m_off = c->m_off;
|
||||
|
||||
#if 0
|
||||
printf("%5ld: %5d len:%3d off:%5d\n", (c->ip-c->look)-in, c->look,
|
||||
m_len, m_off);
|
||||
printf("%5ld: %5d len:%3d off:%5d\n", (c->ip - c->look) - in, c->look,
|
||||
m_len, m_off);
|
||||
#endif
|
||||
|
||||
assert(c->ip - c->look >= in);
|
||||
|
||||
if (lit == 0)
|
||||
ii = c->ip - c->look;
|
||||
|
||||
assert(ii + lit == c->ip - c->look);
|
||||
assert(swd->b_char == *(c->ip - c->look));
|
||||
|
||||
if ((m_len < M2_MIN_LEN) ||
|
||||
(m_len < M3_MIN_LEN && m_off > M2_MAX_OFFSET))
|
||||
(m_len < M3_MIN_LEN && m_off > M2_MAX_OFFSET))
|
||||
{
|
||||
m_len = 0;
|
||||
}
|
||||
@@ -192,20 +203,24 @@ lzo1b_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
lazy_match_min_gain = 1;
|
||||
|
||||
#if (M2_MIN_LEN == 2)
|
||||
|
||||
if (m_len == 2)
|
||||
{
|
||||
/* don't code a match of len 2 if we have to
|
||||
code a literal run. Code a literal instead. */
|
||||
m_len = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#if (M2_MIN_LEN == M3_MIN_LEN)
|
||||
|
||||
if (m_len == M2_MIN_LEN && m_off > M2_MAX_OFFSET)
|
||||
{
|
||||
/* don't code a M3 match of len 3 if we have to
|
||||
code a literal run. Code a literal instead. */
|
||||
m_len = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@@ -223,16 +238,18 @@ lzo1b_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
/* try a lazy match */
|
||||
if (m_len == 0)
|
||||
lazy_match_min_gain = -1;
|
||||
|
||||
if (lazy_match_min_gain >= 0 && c->look > m_len)
|
||||
{
|
||||
assert(m_len > 0);
|
||||
|
||||
r = find_match(c,swd,1,0);
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
r = find_match(c, swd, 1, 0);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
assert(c->look > 0);
|
||||
|
||||
if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET &&
|
||||
c->m_off > M2_MAX_OFFSET)
|
||||
c->m_off > M2_MAX_OFFSET)
|
||||
lazy_match_min_gain += 1;
|
||||
|
||||
if (c->m_len >= m_len + lazy_match_min_gain)
|
||||
@@ -253,8 +270,10 @@ lzo1b_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
ahead = 1;
|
||||
assert(ii + lit + 1 == c->ip - c->look);
|
||||
}
|
||||
|
||||
assert(m_len > 0);
|
||||
}
|
||||
|
||||
assert(ii + lit + ahead == c->ip - c->look);
|
||||
|
||||
|
||||
@@ -262,8 +281,9 @@ lzo1b_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
{
|
||||
/* a literal */
|
||||
lit++;
|
||||
r = find_match(c,swd,1,0);
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
r = find_match(c, swd, 1, 0);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -284,21 +304,24 @@ lzo1b_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
}
|
||||
else
|
||||
{
|
||||
op = STORE_RUN(op,ii,lit);
|
||||
op = STORE_RUN(op, ii, lit);
|
||||
}
|
||||
|
||||
if (lit < R0FAST)
|
||||
c->r1_m_len = m_len;
|
||||
else
|
||||
c->r1_m_len = 0;
|
||||
|
||||
lit = 0;
|
||||
}
|
||||
else
|
||||
c->r1_m_len = 0;
|
||||
|
||||
/* 2 - code match */
|
||||
op = code_match(c,op,m_len,m_off);
|
||||
r = find_match(c,swd,m_len,1+ahead);
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
op = code_match(c, op, m_len, m_off);
|
||||
r = find_match(c, swd, m_len, 1 + ahead);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
}
|
||||
|
||||
c->codesize = pd(op, out);
|
||||
@@ -307,7 +330,7 @@ lzo1b_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
/* store final run */
|
||||
if (lit > 0)
|
||||
op = STORE_RUN(op,ii,lit);
|
||||
op = STORE_RUN(op, ii, lit);
|
||||
|
||||
#if defined(LZO_EOF_CODE)
|
||||
*op++ = M3_MARKER | 1;
|
||||
@@ -325,8 +348,8 @@ lzo1b_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
#if 0
|
||||
printf("%ld %ld -> %ld: %ld %ld %ld %ld %ld\n",
|
||||
(long) c->textsize, (long)in_len, (long) c->codesize,
|
||||
c->r1_r, c->m3_r, c->m2_m, c->m3_m, c->lazy);
|
||||
(long) c->textsize, (long)in_len, (long) c->codesize,
|
||||
c->r1_r, c->m3_r, c->m2_m, c->m3_m, c->lazy);
|
||||
#endif
|
||||
return LZO_E_OK;
|
||||
}
|
||||
@@ -338,11 +361,11 @@ lzo1b_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1b_999_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
lzo1b_999_compress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return lzo1b_999_compress_callback(in,in_len,out,out_len,wrkmem,
|
||||
return lzo1b_999_compress_callback(in, in_len, out, out_len, wrkmem,
|
||||
(lzo_callback_p) 0, 0);
|
||||
}
|
||||
|
||||
|
||||
65
extern/lzo/src/lzo1b_c.ch
vendored
65
extern/lzo/src/lzo1b_c.ch
vendored
@@ -63,9 +63,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
LZO_PRIVATE(int)
|
||||
do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
do_compress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
const lzo_bytep ip;
|
||||
#if (DD_BITS > 0)
|
||||
@@ -101,7 +101,7 @@ do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
/* init dictionary */
|
||||
#if (LZO_DETERMINISTIC)
|
||||
BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE);
|
||||
BZERO8_PTR(wrkmem, sizeof(lzo_dict_t), D_SIZE);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -111,15 +111,16 @@ do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
|
||||
#if (DD_BITS > 0)
|
||||
DVAL_FIRST(dv,ip);
|
||||
UPDATE_D(dict,drun,dv,ip,in);
|
||||
DVAL_FIRST(dv, ip);
|
||||
UPDATE_D(dict, drun, dv, ip, in);
|
||||
ip++;
|
||||
DVAL_NEXT(dv,ip);
|
||||
DVAL_NEXT(dv, ip);
|
||||
#else
|
||||
ip++;
|
||||
#endif
|
||||
|
||||
assert(ip < ip_end);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
const lzo_bytep m_pos;
|
||||
@@ -133,9 +134,9 @@ do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_uint m_len;
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// search for a match
|
||||
************************************************************************/
|
||||
/***********************************************************************
|
||||
// search for a match
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(LZO_SEARCH_MATCH_INCLUDE_FILE)
|
||||
# define LZO_SEARCH_MATCH_INCLUDE_FILE "lzo1b_sm.ch"
|
||||
@@ -152,32 +153,34 @@ do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// found a literal
|
||||
************************************************************************/
|
||||
/***********************************************************************
|
||||
// found a literal
|
||||
************************************************************************/
|
||||
|
||||
|
||||
/* a literal */
|
||||
/* a literal */
|
||||
literal:
|
||||
#if (DD_BITS == 0)
|
||||
UPDATE_I(dict,0,dindex,ip,in);
|
||||
UPDATE_I(dict, 0, dindex, ip, in);
|
||||
#endif
|
||||
|
||||
if (++ip >= ip_end)
|
||||
break;
|
||||
|
||||
#if (DD_BITS > 0)
|
||||
DVAL_NEXT(dv,ip);
|
||||
DVAL_NEXT(dv, ip);
|
||||
#endif
|
||||
continue;
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// found a match
|
||||
************************************************************************/
|
||||
/***********************************************************************
|
||||
// found a match
|
||||
************************************************************************/
|
||||
|
||||
match:
|
||||
#if (DD_BITS == 0)
|
||||
UPDATE_I(dict,0,dindex,ip,in);
|
||||
UPDATE_I(dict, 0, dindex, ip, in);
|
||||
#endif
|
||||
/* we have found a match of at least M2_MIN_LEN */
|
||||
|
||||
@@ -193,9 +196,9 @@ match:
|
||||
assert(ii == ip);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// code the match
|
||||
************************************************************************/
|
||||
/***********************************************************************
|
||||
// code the match
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(LZO_CODE_MATCH_INCLUDE_FILE)
|
||||
# define LZO_CODE_MATCH_INCLUDE_FILE "lzo1b_cm.ch"
|
||||
@@ -210,9 +213,9 @@ match:
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// end of block
|
||||
************************************************************************/
|
||||
/***********************************************************************
|
||||
// end of block
|
||||
************************************************************************/
|
||||
|
||||
assert(ip <= in_end);
|
||||
|
||||
@@ -224,9 +227,11 @@ match:
|
||||
for (i = 0; i < D_SIZE; i++)
|
||||
{
|
||||
p = dict[i];
|
||||
|
||||
if (BOUNDS_CHECKING_OFF_IN_EXPR(p == NULL || p < in || p > in_end))
|
||||
lzo_stats->unused_dict_entries++;
|
||||
}
|
||||
|
||||
lzo_stats->unused_dict_entries_percent =
|
||||
100.0 * lzo_stats->unused_dict_entries / D_SIZE;
|
||||
}
|
||||
@@ -234,6 +239,7 @@ match:
|
||||
|
||||
|
||||
#if defined(LZO_RETURN_IF_NOT_COMPRESSIBLE)
|
||||
|
||||
/* return if op == out to indicate that we
|
||||
* couldn't compress and didn't copy anything.
|
||||
*/
|
||||
@@ -242,13 +248,14 @@ match:
|
||||
*out_len = 0;
|
||||
return LZO_E_NOT_COMPRESSIBLE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* store the final literal run */
|
||||
if (pd(in_end,ii) > 0)
|
||||
if (pd(in_end, ii) > 0)
|
||||
{
|
||||
lzo_uint t = pd(in_end,ii);
|
||||
op = STORE_RUN(op,ii,t);
|
||||
lzo_uint t = pd(in_end, ii);
|
||||
op = STORE_RUN(op, ii, t);
|
||||
}
|
||||
|
||||
*out_len = pd(op, out);
|
||||
|
||||
42
extern/lzo/src/lzo1b_cc.c
vendored
42
extern/lzo/src/lzo1b_cc.c
vendored
@@ -35,10 +35,10 @@
|
||||
************************************************************************/
|
||||
|
||||
LZO_LOCAL_IMPL(int)
|
||||
_lzo1b_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_compress_t func )
|
||||
_lzo1b_do_compress(const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_compress_t func)
|
||||
{
|
||||
int r;
|
||||
#if defined(LZO_TEST_COMPRESS_OVERRUN)
|
||||
@@ -64,19 +64,22 @@ _lzo1b_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
*out_len = 0;
|
||||
r = LZO_E_NOT_COMPRESSIBLE;
|
||||
#else
|
||||
*out_len = pd(STORE_RUN(out,in,in_len), out);
|
||||
*out_len = pd(STORE_RUN(out, in, in_len), out);
|
||||
r = (*out_len > in_len) ? LZO_E_OK : LZO_E_ERROR;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
r = func(in,in_len,out,out_len,wrkmem);
|
||||
r = func(in, in_len, out, out_len, wrkmem);
|
||||
|
||||
|
||||
#if defined(LZO_EOF_CODE)
|
||||
#if defined(LZO_TEST_COMPRESS_OVERRUN)
|
||||
|
||||
if (r == LZO_E_OK && avail_out - *out_len < 3)
|
||||
r = LZO_E_COMPRESS_OVERRUN;
|
||||
|
||||
#endif
|
||||
|
||||
if (r == LZO_E_OK)
|
||||
{
|
||||
lzo_bytep op = out + *out_len;
|
||||
@@ -85,14 +88,15 @@ _lzo1b_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
op[2] = 0;
|
||||
*out_len += 3;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if (LZO_COLLECT_STATS)
|
||||
lzo_stats->out_len = *out_len;
|
||||
lzo_stats->match_bytes =
|
||||
1 * lzo_stats->m1_matches + 2 * lzo_stats->m2_matches +
|
||||
3 * lzo_stats->m3_matches + 4 * lzo_stats->m4_matches;
|
||||
1 * lzo_stats->m1_matches + 2 * lzo_stats->m2_matches +
|
||||
3 * lzo_stats->m3_matches + 4 * lzo_stats->m4_matches;
|
||||
_lzo1b_stats_calc(lzo_stats);
|
||||
#endif
|
||||
|
||||
@@ -112,30 +116,30 @@ _lzo1b_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
#if (LZO_COLLECT_STATS)
|
||||
|
||||
static lzo_stats_t lzo_statistics;
|
||||
lzo_stats_t * const lzo1b_stats = &lzo_statistics;
|
||||
lzo_stats_t* const lzo1b_stats = &lzo_statistics;
|
||||
|
||||
|
||||
void _lzo1b_stats_init(lzo_stats_t *lzo_stats)
|
||||
void _lzo1b_stats_init(lzo_stats_t* lzo_stats)
|
||||
{
|
||||
lzo_memset(lzo_stats,0,sizeof(*lzo_stats));
|
||||
lzo_memset(lzo_stats, 0, sizeof(*lzo_stats));
|
||||
}
|
||||
|
||||
|
||||
void _lzo1b_stats_calc(lzo_stats_t *lzo_stats)
|
||||
void _lzo1b_stats_calc(lzo_stats_t* lzo_stats)
|
||||
{
|
||||
lzo_stats->matches =
|
||||
lzo_stats->m1_matches + lzo_stats->m2_matches +
|
||||
lzo_stats->m3_matches + lzo_stats->m4_matches;
|
||||
lzo_stats->m1_matches + lzo_stats->m2_matches +
|
||||
lzo_stats->m3_matches + lzo_stats->m4_matches;
|
||||
|
||||
lzo_stats->literal_overhead = lzo_stats->lit_runs +
|
||||
2 * (lzo_stats->r0short_runs + lzo_stats->r0fast_runs +
|
||||
lzo_stats->r0long_runs);
|
||||
2 * (lzo_stats->r0short_runs + lzo_stats->r0fast_runs +
|
||||
lzo_stats->r0long_runs);
|
||||
lzo_stats->literal_bytes = lzo_stats->literals +
|
||||
lzo_stats->literal_overhead;
|
||||
lzo_stats->literal_overhead;
|
||||
|
||||
#if 0
|
||||
assert(lzo_stats->match_bytes + lzo_stats->literal_bytes ==
|
||||
lzo_stats->out_len);
|
||||
lzo_stats->out_len);
|
||||
#endif
|
||||
|
||||
lzo_stats->m2_matches -= lzo_stats->r1_matches;
|
||||
@@ -143,7 +147,7 @@ void _lzo1b_stats_calc(lzo_stats_t *lzo_stats)
|
||||
|
||||
if (lzo_stats->literals > 0)
|
||||
lzo_stats->literal_overhead_percent =
|
||||
100.0 * lzo_stats->literal_overhead / lzo_stats->literals;
|
||||
100.0 * lzo_stats->literal_overhead / lzo_stats->literals;
|
||||
}
|
||||
|
||||
|
||||
|
||||
14
extern/lzo/src/lzo1b_cc.h
vendored
14
extern/lzo/src/lzo1b_cc.h
vendored
@@ -57,18 +57,18 @@ extern const lzo_compress_t _lzo1b_99_compress_func;
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
LZO_LOCAL_DECL(lzo_bytep )
|
||||
_lzo1b_store_run ( lzo_bytep const oo, const lzo_bytep const ii,
|
||||
lzo_uint r_len);
|
||||
LZO_LOCAL_DECL(lzo_bytep)
|
||||
_lzo1b_store_run(lzo_bytep const oo, const lzo_bytep const ii,
|
||||
lzo_uint r_len);
|
||||
|
||||
#define STORE_RUN _lzo1b_store_run
|
||||
|
||||
|
||||
LZO_LOCAL_DECL(int)
|
||||
_lzo1b_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_compress_t func );
|
||||
_lzo1b_do_compress(const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_compress_t func);
|
||||
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
378
extern/lzo/src/lzo1b_cm.ch
vendored
378
extern/lzo/src/lzo1b_cm.ch
vendored
@@ -39,21 +39,21 @@
|
||||
|
||||
#if (DD_BITS == 0)
|
||||
|
||||
/* we already matched M2_MIN_LEN bytes,
|
||||
* m_pos also already advanced M2_MIN_LEN bytes */
|
||||
ip += M2_MIN_LEN;
|
||||
assert(m_pos < ip);
|
||||
/* we already matched M2_MIN_LEN bytes,
|
||||
* m_pos also already advanced M2_MIN_LEN bytes */
|
||||
ip += M2_MIN_LEN;
|
||||
assert(m_pos < ip);
|
||||
|
||||
/* try to match another M2_MAX_LEN + 1 - M2_MIN_LEN bytes
|
||||
* to see if we get more than a M2 match */
|
||||
/* try to match another M2_MAX_LEN + 1 - M2_MIN_LEN bytes
|
||||
* to see if we get more than a M2 match */
|
||||
#define M2_OR_M3 (MATCH_M2)
|
||||
|
||||
#else /* (DD_BITS == 0) */
|
||||
|
||||
/* we already matched m_len bytes */
|
||||
assert(m_len >= M2_MIN_LEN);
|
||||
ip += m_len;
|
||||
assert(ip <= in_end);
|
||||
/* we already matched m_len bytes */
|
||||
assert(m_len >= M2_MIN_LEN);
|
||||
ip += m_len;
|
||||
assert(ip <= in_end);
|
||||
|
||||
#define M2_OR_M3 (m_len <= M2_MAX_LEN)
|
||||
|
||||
@@ -61,220 +61,234 @@
|
||||
|
||||
|
||||
|
||||
if (M2_OR_M3)
|
||||
{
|
||||
/* we've found a M2 or M3 match */
|
||||
assert(ip <= in_end);
|
||||
if (M2_OR_M3)
|
||||
{
|
||||
/* we've found a M2 or M3 match */
|
||||
assert(ip <= in_end);
|
||||
|
||||
/* 2a) compute match parameters */
|
||||
/* 2a) compute match parameters */
|
||||
#if (DD_BITS == 0)
|
||||
assert(pd(ip,m_pos) == m_off);
|
||||
--ip; /* ran one too far, point back to non-match */
|
||||
m_len = pd(ip, ii);
|
||||
assert(pd(ip, m_pos) == m_off);
|
||||
--ip; /* ran one too far, point back to non-match */
|
||||
m_len = pd(ip, ii);
|
||||
#endif
|
||||
|
||||
/* 2a2) verify match parameters */
|
||||
assert(m_len >= M2_MIN_LEN);
|
||||
assert(m_len <= M2_MAX_LEN);
|
||||
assert(m_len <= M3_MAX_LEN);
|
||||
/* 2a2) verify match parameters */
|
||||
assert(m_len >= M2_MIN_LEN);
|
||||
assert(m_len <= M2_MAX_LEN);
|
||||
assert(m_len <= M3_MAX_LEN);
|
||||
|
||||
assert(m_off >= M2_MIN_OFFSET);
|
||||
assert(m_off >= M3_MIN_OFFSET);
|
||||
assert(m_off <= M3_MAX_OFFSET);
|
||||
assert(ii-m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav,ii,m_len) == 0);
|
||||
assert(m_off >= M2_MIN_OFFSET);
|
||||
assert(m_off >= M3_MIN_OFFSET);
|
||||
assert(m_off <= M3_MAX_OFFSET);
|
||||
assert(ii - m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav, ii, m_len) == 0);
|
||||
|
||||
/* 2b) code the match */
|
||||
/* 2b) code the match */
|
||||
#if (_M2_MAX_OFFSET != _M3_MAX_OFFSET)
|
||||
if (m_off <= M2_MAX_OFFSET)
|
||||
{
|
||||
|
||||
if (m_off <= M2_MAX_OFFSET)
|
||||
{
|
||||
#else
|
||||
assert(m_off <= M2_MAX_OFFSET);
|
||||
assert(m_off <= M2_MAX_OFFSET);
|
||||
#endif
|
||||
m_off -= M2_MIN_OFFSET;
|
||||
/* code match len + low offset bits */
|
||||
*op++ = LZO_BYTE(((m_len - (M2_MIN_LEN - 2)) << M2O_BITS) |
|
||||
(m_off & M2O_MASK));
|
||||
/* code high offset bits */
|
||||
*op++ = LZO_BYTE(m_off >> M2O_BITS);
|
||||
LZO_STATS(lzo_stats->m2_matches++);
|
||||
LZO_STATS(lzo_stats->m2_match[m_len]++);
|
||||
m_off -= M2_MIN_OFFSET;
|
||||
/* code match len + low offset bits */
|
||||
*op++ = LZO_BYTE(((m_len - (M2_MIN_LEN - 2)) << M2O_BITS) |
|
||||
(m_off & M2O_MASK));
|
||||
/* code high offset bits */
|
||||
*op++ = LZO_BYTE(m_off >> M2O_BITS);
|
||||
LZO_STATS(lzo_stats->m2_matches++);
|
||||
LZO_STATS(lzo_stats->m2_match[m_len]++);
|
||||
#if (_M2_MAX_OFFSET != _M3_MAX_OFFSET)
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(LZO_HAVE_R1)
|
||||
#if (M3_MIN_LEN == M2_MIN_LEN)
|
||||
r1 = ip_end; /* invalidate R1 pointer */
|
||||
r1 = ip_end; /* invalidate R1 pointer */
|
||||
#endif
|
||||
#endif
|
||||
assert(m_len >= M3_MIN_LEN);
|
||||
m_off -= M3_MIN_OFFSET - M3_EOF_OFFSET;
|
||||
/* code match len */
|
||||
*op++ = LZO_BYTE(M3_MARKER | (m_len - (M3_MIN_LEN - 1)));
|
||||
/* code low offset bits */
|
||||
*op++ = LZO_BYTE(m_off & M3O_MASK);
|
||||
/* code high offset bits */
|
||||
*op++ = LZO_BYTE(m_off >> M3O_BITS);
|
||||
LZO_STATS(lzo_stats->m3_matches++);
|
||||
LZO_STATS(lzo_stats->m3_match[m_len]++);
|
||||
assert(m_len >= M3_MIN_LEN);
|
||||
m_off -= M3_MIN_OFFSET - M3_EOF_OFFSET;
|
||||
/* code match len */
|
||||
*op++ = LZO_BYTE(M3_MARKER | (m_len - (M3_MIN_LEN - 1)));
|
||||
/* code low offset bits */
|
||||
*op++ = LZO_BYTE(m_off & M3O_MASK);
|
||||
/* code high offset bits */
|
||||
*op++ = LZO_BYTE(m_off >> M3O_BITS);
|
||||
LZO_STATS(lzo_stats->m3_matches++);
|
||||
LZO_STATS(lzo_stats->m3_match[m_len]++);
|
||||
#if defined(LZO_HAVE_M3)
|
||||
m3 = op; /* set M3 pointer */
|
||||
m3 = op; /* set M3 pointer */
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* (_M2_MAX_OFFSET != _M3_MAX_OFFSET) */
|
||||
|
||||
|
||||
if (ip >= ip_end)
|
||||
{
|
||||
ii = ip;
|
||||
break;
|
||||
}
|
||||
if (ip >= ip_end)
|
||||
{
|
||||
ii = ip;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
|
||||
#if (CLEVEL == 9) || (CLEVEL >= 7 && M2L_BITS <= 4) || (CLEVEL >= 5 && M2L_BITS <= 3)
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
++ii;
|
||||
do {
|
||||
DVAL_NEXT(dv,ii);
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
++ii;
|
||||
|
||||
do
|
||||
{
|
||||
DVAL_NEXT(dv, ii);
|
||||
#if 0
|
||||
UPDATE_D(dict,drun,dv,ii,in);
|
||||
UPDATE_D(dict, drun, dv, ii, in);
|
||||
#else
|
||||
dict[ DINDEX(dv,ii) ] = DENTRY(ii,in);
|
||||
dict[ DINDEX(dv, ii) ] = DENTRY(ii, in);
|
||||
#endif
|
||||
MI
|
||||
} while (++ii < ip);
|
||||
DVAL_NEXT(dv,ii);
|
||||
assert(ii == ip);
|
||||
DVAL_ASSERT(dv,ip);
|
||||
MI
|
||||
}
|
||||
while (++ii < ip);
|
||||
|
||||
DVAL_NEXT(dv, ii);
|
||||
assert(ii == ip);
|
||||
DVAL_ASSERT(dv, ip);
|
||||
#elif (CLEVEL >= 3)
|
||||
SI DI DI XI
|
||||
SI DI DI XI
|
||||
#elif (CLEVEL >= 2)
|
||||
SI DI XI
|
||||
SI DI XI
|
||||
#else
|
||||
XI
|
||||
XI
|
||||
#endif
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
/* we've found a M3 or M4 match - see how far we can still go */
|
||||
assert(ip <= in_end);
|
||||
assert(lzo_memcmp(m_pos_sav, ii, (lzo_uint)(ip - ii)) == 0);
|
||||
|
||||
/* 2a) compute match parameters */
|
||||
#if !defined(MATCH_IP_END)
|
||||
assert(ii == ip - (M2_MAX_LEN + 1));
|
||||
#if (DD_BITS > 0)
|
||||
assert(m_len == (lzo_uint)(ip - ii));
|
||||
m_pos = ip - m_off;
|
||||
assert(m_pos == m_pos_sav + m_len);
|
||||
#endif
|
||||
{
|
||||
const lzo_bytep end;
|
||||
end = in_end;
|
||||
|
||||
while (ip < end && *m_pos == *ip)
|
||||
m_pos++, ip++;
|
||||
|
||||
assert(ip <= in_end);
|
||||
m_len = pd(ip, ii);
|
||||
}
|
||||
assert(pd(ip, m_pos) == m_off);
|
||||
#endif
|
||||
|
||||
/* 2a2) verify match parameters */
|
||||
assert(m_len >= M3_MIN_LEN);
|
||||
|
||||
assert(m_off >= M3_MIN_OFFSET);
|
||||
assert(m_off >= M4_MIN_OFFSET);
|
||||
assert(m_off <= M3_MAX_OFFSET);
|
||||
assert(m_off <= M4_MAX_OFFSET);
|
||||
assert(ii - m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav, ii, m_len) == 0);
|
||||
|
||||
/* 2b) code the match */
|
||||
if (m_len <= M3_MAX_LEN)
|
||||
{
|
||||
/* code match len */
|
||||
*op++ = LZO_BYTE(M3_MARKER | (m_len - (M3_MIN_LEN - 1)));
|
||||
LZO_STATS(lzo_stats->m3_matches++);
|
||||
LZO_STATS(lzo_stats->m3_match[m_len]++);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(m_len >= M4_MIN_LEN);
|
||||
/* code M4 match len flag */
|
||||
*op++ = M4_MARKER;
|
||||
/* code match len */
|
||||
m_len -= M4_MIN_LEN - 1;
|
||||
|
||||
while (m_len > 255)
|
||||
{
|
||||
m_len -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
|
||||
else
|
||||
assert(m_len > 0);
|
||||
*op++ = LZO_BYTE(m_len);
|
||||
LZO_STATS(lzo_stats->m4_matches++);
|
||||
}
|
||||
|
||||
{
|
||||
/* we've found a M3 or M4 match - see how far we can still go */
|
||||
assert(ip <= in_end);
|
||||
assert(lzo_memcmp(m_pos_sav,ii,(lzo_uint)(ip-ii)) == 0);
|
||||
|
||||
/* 2a) compute match parameters */
|
||||
#if !defined(MATCH_IP_END)
|
||||
assert(ii == ip - (M2_MAX_LEN + 1));
|
||||
#if (DD_BITS > 0)
|
||||
assert(m_len == (lzo_uint)(ip-ii));
|
||||
m_pos = ip - m_off;
|
||||
assert(m_pos == m_pos_sav + m_len);
|
||||
#endif
|
||||
{
|
||||
const lzo_bytep end;
|
||||
end = in_end;
|
||||
while (ip < end && *m_pos == *ip)
|
||||
m_pos++, ip++;
|
||||
assert(ip <= in_end);
|
||||
m_len = pd(ip, ii);
|
||||
}
|
||||
assert(pd(ip,m_pos) == m_off);
|
||||
#endif
|
||||
|
||||
/* 2a2) verify match parameters */
|
||||
assert(m_len >= M3_MIN_LEN);
|
||||
|
||||
assert(m_off >= M3_MIN_OFFSET);
|
||||
assert(m_off >= M4_MIN_OFFSET);
|
||||
assert(m_off <= M3_MAX_OFFSET);
|
||||
assert(m_off <= M4_MAX_OFFSET);
|
||||
assert(ii-m_off == m_pos_sav);
|
||||
assert(lzo_memcmp(m_pos_sav,ii,m_len) == 0);
|
||||
|
||||
/* 2b) code the match */
|
||||
if (m_len <= M3_MAX_LEN)
|
||||
{
|
||||
/* code match len */
|
||||
*op++ = LZO_BYTE(M3_MARKER | (m_len - (M3_MIN_LEN - 1)));
|
||||
LZO_STATS(lzo_stats->m3_matches++);
|
||||
LZO_STATS(lzo_stats->m3_match[m_len]++);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(m_len >= M4_MIN_LEN);
|
||||
/* code M4 match len flag */
|
||||
*op++ = M4_MARKER;
|
||||
/* code match len */
|
||||
m_len -= M4_MIN_LEN - 1;
|
||||
while (m_len > 255)
|
||||
{
|
||||
m_len -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
assert(m_len > 0);
|
||||
*op++ = LZO_BYTE(m_len);
|
||||
LZO_STATS(lzo_stats->m4_matches++);
|
||||
}
|
||||
|
||||
m_off -= M3_MIN_OFFSET - M3_EOF_OFFSET;
|
||||
/* code low offset bits */
|
||||
*op++ = LZO_BYTE(m_off & M3O_MASK);
|
||||
/* code high offset bits */
|
||||
*op++ = LZO_BYTE(m_off >> M3O_BITS);
|
||||
m_off -= M3_MIN_OFFSET - M3_EOF_OFFSET;
|
||||
/* code low offset bits */
|
||||
*op++ = LZO_BYTE(m_off & M3O_MASK);
|
||||
/* code high offset bits */
|
||||
*op++ = LZO_BYTE(m_off >> M3O_BITS);
|
||||
|
||||
#if defined(LZO_HAVE_M3)
|
||||
m3 = op; /* set M3 pointer */
|
||||
m3 = op; /* set M3 pointer */
|
||||
#endif
|
||||
|
||||
|
||||
if (ip >= ip_end)
|
||||
{
|
||||
ii = ip;
|
||||
break;
|
||||
}
|
||||
if (ip >= ip_end)
|
||||
{
|
||||
ii = ip;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
/* 2c) Insert phrases (beginning with ii+1) into the dictionary. */
|
||||
#if (CLEVEL == 9)
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
/* This is not recommended because it can be slow. */
|
||||
++ii;
|
||||
do {
|
||||
DVAL_NEXT(dv,ii);
|
||||
#if 0
|
||||
UPDATE_D(dict,drun,dv,ii,in);
|
||||
#else
|
||||
dict[ DINDEX(dv,ii) ] = DENTRY(ii,in);
|
||||
#endif
|
||||
MI
|
||||
} while (++ii < ip);
|
||||
DVAL_NEXT(dv,ii);
|
||||
assert(ii == ip);
|
||||
DVAL_ASSERT(dv,ip);
|
||||
#elif (CLEVEL >= 8)
|
||||
SI DI DI DI DI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 7)
|
||||
SI DI DI DI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 6)
|
||||
SI DI DI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 5)
|
||||
SI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 4)
|
||||
SI DI DI DI XI
|
||||
#elif (CLEVEL >= 3)
|
||||
SI DI DI XI
|
||||
#elif (CLEVEL >= 2)
|
||||
SI DI XI
|
||||
#else
|
||||
XI
|
||||
#endif
|
||||
}
|
||||
/* Insert the whole match (ii+1)..(ip-1) into dictionary. */
|
||||
/* This is not recommended because it can be slow. */
|
||||
++ii;
|
||||
|
||||
/* ii now points to the start of the next literal run */
|
||||
assert(ii == ip);
|
||||
do
|
||||
{
|
||||
DVAL_NEXT(dv, ii);
|
||||
#if 0
|
||||
UPDATE_D(dict, drun, dv, ii, in);
|
||||
#else
|
||||
dict[ DINDEX(dv, ii) ] = DENTRY(ii, in);
|
||||
#endif
|
||||
MI
|
||||
}
|
||||
while (++ii < ip);
|
||||
|
||||
DVAL_NEXT(dv, ii);
|
||||
assert(ii == ip);
|
||||
DVAL_ASSERT(dv, ip);
|
||||
#elif (CLEVEL >= 8)
|
||||
SI DI DI DI DI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 7)
|
||||
SI DI DI DI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 6)
|
||||
SI DI DI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 5)
|
||||
SI DI DI DI DI XI
|
||||
#elif (CLEVEL >= 4)
|
||||
SI DI DI DI XI
|
||||
#elif (CLEVEL >= 3)
|
||||
SI DI DI XI
|
||||
#elif (CLEVEL >= 2)
|
||||
SI DI XI
|
||||
#else
|
||||
XI
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ii now points to the start of the next literal run */
|
||||
assert(ii == ip);
|
||||
|
||||
|
||||
/* vim:set ts=4 sw=4 et: */
|
||||
|
||||
117
extern/lzo/src/lzo1b_cr.ch
vendored
117
extern/lzo/src/lzo1b_cr.ch
vendored
@@ -37,76 +37,81 @@
|
||||
// store the current literal run
|
||||
************************************************************************/
|
||||
|
||||
assert(ip < ip_end);
|
||||
if (pd(ip,ii) > 0)
|
||||
{
|
||||
lzo_uint t = pd(ip,ii);
|
||||
assert(ip < ip_end);
|
||||
|
||||
if (pd(ip, ii) > 0)
|
||||
{
|
||||
lzo_uint t = pd(ip, ii);
|
||||
|
||||
#if defined(LZO_HAVE_R1)
|
||||
if (ip == r1)
|
||||
{
|
||||
/* Code a context sensitive R1 match. */
|
||||
LZO_STATS(lzo_stats->literals += t);
|
||||
LZO_STATS(lzo_stats->r1_matches++);
|
||||
assert(t == 1);
|
||||
/* modify marker byte */
|
||||
assert((op[-2] >> M2O_BITS) == (M2_MARKER >> M2O_BITS));
|
||||
op[-2] &= M2O_MASK;
|
||||
assert((op[-2] >> M2O_BITS) == 0);
|
||||
/* copy 1 literal */
|
||||
*op++ = *ii++;
|
||||
r1 = ip + (M2_MIN_LEN + 1); /* set new R1 pointer */
|
||||
}
|
||||
else
|
||||
|
||||
if (ip == r1)
|
||||
{
|
||||
/* Code a context sensitive R1 match. */
|
||||
LZO_STATS(lzo_stats->literals += t);
|
||||
LZO_STATS(lzo_stats->r1_matches++);
|
||||
assert(t == 1);
|
||||
/* modify marker byte */
|
||||
assert((op[-2] >> M2O_BITS) == (M2_MARKER >> M2O_BITS));
|
||||
op[-2] &= M2O_MASK;
|
||||
assert((op[-2] >> M2O_BITS) == 0);
|
||||
/* copy 1 literal */
|
||||
*op++ = *ii++;
|
||||
r1 = ip + (M2_MIN_LEN + 1); /* set new R1 pointer */
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (t < R0MIN)
|
||||
{
|
||||
/* inline the copying of a short run */
|
||||
LZO_STATS(lzo_stats->literals += t);
|
||||
LZO_STATS(lzo_stats->lit_runs++);
|
||||
LZO_STATS(lzo_stats->lit_run[t]++);
|
||||
if (t < R0MIN)
|
||||
{
|
||||
/* inline the copying of a short run */
|
||||
LZO_STATS(lzo_stats->literals += t);
|
||||
LZO_STATS(lzo_stats->lit_runs++);
|
||||
LZO_STATS(lzo_stats->lit_run[t]++);
|
||||
#if defined(LZO_HAVE_M3)
|
||||
if (t < LZO_SIZE(8-M3O_BITS) && op == m3)
|
||||
{
|
||||
|
||||
if (t < LZO_SIZE(8 - M3O_BITS) && op == m3)
|
||||
{
|
||||
/* Code a very short literal run into the low offset bits
|
||||
* of the previous M3/M4 match.
|
||||
*/
|
||||
LZO_STATS(lzo_stats->lit_runs_after_m3_match++);
|
||||
LZO_STATS(lzo_stats->lit_run_after_m3_match[t]++);
|
||||
assert((m3[-2] >> M3O_BITS) == 0);
|
||||
m3[-2] = LZO_BYTE(m3[-2] | (t << M3O_BITS));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
*op++ = LZO_BYTE(t);
|
||||
}
|
||||
MEMCPY_DS(op, ii, t);
|
||||
#if defined(LZO_HAVE_R1)
|
||||
r1 = ip + (M2_MIN_LEN + 1); /* set new R1 pointer */
|
||||
#endif
|
||||
}
|
||||
else if (t < R0FAST)
|
||||
{
|
||||
/* inline the copying of a short R0 run */
|
||||
LZO_STATS(lzo_stats->literals += t);
|
||||
LZO_STATS(lzo_stats->r0short_runs++);
|
||||
*op++ = 0; *op++ = LZO_BYTE(t - R0MIN);
|
||||
MEMCPY_DS(op, ii, t);
|
||||
#if defined(LZO_HAVE_R1)
|
||||
r1 = ip + (M2_MIN_LEN + 1); /* set new R1 pointer */
|
||||
#endif
|
||||
LZO_STATS(lzo_stats->lit_runs_after_m3_match++);
|
||||
LZO_STATS(lzo_stats->lit_run_after_m3_match[t]++);
|
||||
assert((m3[-2] >> M3O_BITS) == 0);
|
||||
m3[-2] = LZO_BYTE(m3[-2] | (t << M3O_BITS));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
op = STORE_RUN(op,ii,t);
|
||||
ii = ip;
|
||||
*op++ = LZO_BYTE(t);
|
||||
}
|
||||
|
||||
MEMCPY_DS(op, ii, t);
|
||||
#if defined(LZO_HAVE_R1)
|
||||
r1 = ip + (M2_MIN_LEN + 1); /* set new R1 pointer */
|
||||
#endif
|
||||
}
|
||||
else if (t < R0FAST)
|
||||
{
|
||||
/* inline the copying of a short R0 run */
|
||||
LZO_STATS(lzo_stats->literals += t);
|
||||
LZO_STATS(lzo_stats->r0short_runs++);
|
||||
*op++ = 0;
|
||||
*op++ = LZO_BYTE(t - R0MIN);
|
||||
MEMCPY_DS(op, ii, t);
|
||||
#if defined(LZO_HAVE_R1)
|
||||
r1 = ip + (M2_MIN_LEN + 1); /* set new R1 pointer */
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
op = STORE_RUN(op, ii, t);
|
||||
ii = ip;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ii now points to the start of the current match */
|
||||
assert(ii == ip);
|
||||
/* ii now points to the start of the current match */
|
||||
assert(ii == ip);
|
||||
|
||||
|
||||
/* vim:set ts=4 sw=4 et: */
|
||||
|
||||
125
extern/lzo/src/lzo1b_d.ch
vendored
125
extern/lzo/src/lzo1b_d.ch
vendored
@@ -34,9 +34,9 @@
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
DO_DECOMPRESS(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
lzo_bytep op;
|
||||
const lzo_bytep ip;
|
||||
@@ -63,9 +63,11 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
{
|
||||
NEED_IP(1);
|
||||
t = *ip++;
|
||||
|
||||
if (t >= R0FAST - R0MIN) /* a long R0 run */
|
||||
{
|
||||
t -= R0FAST - R0MIN;
|
||||
|
||||
if (t == 0)
|
||||
t = R0FAST;
|
||||
else
|
||||
@@ -75,37 +77,57 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
#else
|
||||
/* help the optimizer */
|
||||
lzo_uint tt = 256;
|
||||
do tt <<= 1; while (--t > 0);
|
||||
|
||||
do tt <<= 1;
|
||||
|
||||
while (--t > 0);
|
||||
|
||||
t = tt;
|
||||
#endif
|
||||
}
|
||||
|
||||
NEED_IP(t); NEED_OP(t);
|
||||
NEED_IP(t);
|
||||
NEED_OP(t);
|
||||
#if 1 && (LZO_OPT_UNALIGNED32)
|
||||
do {
|
||||
UA_COPY4(op+0, ip+0);
|
||||
UA_COPY4(op+4, ip+4);
|
||||
op += 8; ip += 8;
|
||||
|
||||
do
|
||||
{
|
||||
UA_COPY4(op + 0, ip + 0);
|
||||
UA_COPY4(op + 4, ip + 4);
|
||||
op += 8;
|
||||
ip += 8;
|
||||
t -= 8;
|
||||
} while (t > 0);
|
||||
}
|
||||
while (t > 0);
|
||||
|
||||
#else
|
||||
MEMCPY8_DS(op,ip,t);
|
||||
MEMCPY8_DS(op, ip, t);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
t += R0MIN; /* a short R0 run */
|
||||
}
|
||||
|
||||
NEED_IP(t); NEED_OP(t);
|
||||
NEED_IP(t);
|
||||
NEED_OP(t);
|
||||
/* copy literal run */
|
||||
#if 1 && (LZO_OPT_UNALIGNED32)
|
||||
|
||||
if (t >= 4)
|
||||
{
|
||||
do {
|
||||
do
|
||||
{
|
||||
UA_COPY4(op, ip);
|
||||
op += 4; ip += 4; t -= 4;
|
||||
} while (t >= 4);
|
||||
if (t > 0) do *op++ = *ip++; while (--t > 0);
|
||||
op += 4;
|
||||
ip += 4;
|
||||
t -= 4;
|
||||
}
|
||||
while (t >= 4);
|
||||
|
||||
if (t > 0) do* op++ = *ip++;
|
||||
|
||||
while (--t > 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -113,7 +135,10 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
#if (M3O_BITS < 7)
|
||||
literal1:
|
||||
#endif
|
||||
do *op++ = *ip++; while (--t > 0);
|
||||
|
||||
do* op++ = *ip++;
|
||||
|
||||
while (--t > 0);
|
||||
}
|
||||
|
||||
#if (M3O_BITS == 7)
|
||||
@@ -124,16 +149,19 @@ literal2:
|
||||
while (TEST_IP_AND_TEST_OP)
|
||||
{
|
||||
t = *ip++; /* get R1 marker */
|
||||
|
||||
if (t >= R0MIN)
|
||||
goto match;
|
||||
|
||||
NEED_IP(2); NEED_OP(M2_MIN_LEN + 1);
|
||||
NEED_IP(2);
|
||||
NEED_OP(M2_MIN_LEN + 1);
|
||||
|
||||
/* R1 match - a M2_MIN_LEN match + 1 byte literal */
|
||||
/* R1 match - a M2_MIN_LEN match + 1 byte literal */
|
||||
assert((t & M2O_MASK) == t);
|
||||
m_pos = op - M2_MIN_OFFSET;
|
||||
m_pos -= t | (((lzo_uint) *ip++) << M2O_BITS);
|
||||
assert(m_pos >= out); assert(m_pos < op);
|
||||
m_pos -= t | (((lzo_uint) * ip++) << M2O_BITS);
|
||||
assert(m_pos >= out);
|
||||
assert(m_pos < op);
|
||||
TEST_LB(m_pos);
|
||||
COPY_M2;
|
||||
*op++ = *ip++;
|
||||
@@ -151,23 +179,26 @@ match:
|
||||
/* get match offset */
|
||||
NEED_IP(1);
|
||||
m_pos = op - M2_MIN_OFFSET;
|
||||
m_pos -= (t & M2O_MASK) | (((lzo_uint) *ip++) << M2O_BITS);
|
||||
assert(m_pos >= out); assert(m_pos < op);
|
||||
m_pos -= (t & M2O_MASK) | (((lzo_uint) * ip++) << M2O_BITS);
|
||||
assert(m_pos >= out);
|
||||
assert(m_pos < op);
|
||||
TEST_LB(m_pos);
|
||||
|
||||
/* get match len */
|
||||
t = (t >> M2O_BITS) - 1;
|
||||
NEED_OP(t + M2_MIN_LEN - 1);
|
||||
COPY_M2X;
|
||||
MEMCPY_DS(op,m_pos,t);
|
||||
MEMCPY_DS(op, m_pos, t);
|
||||
}
|
||||
else /* a M3 or M4 match */
|
||||
{
|
||||
/* get match len */
|
||||
t &= M3L_MASK;
|
||||
|
||||
if (t == 0) /* a M4 match */
|
||||
{
|
||||
NEED_IP(1);
|
||||
|
||||
while (*ip == 0)
|
||||
{
|
||||
t += 255;
|
||||
@@ -175,6 +206,7 @@ match:
|
||||
TEST_OV(t);
|
||||
NEED_IP(1);
|
||||
}
|
||||
|
||||
t += (M4_MIN_LEN - M3_MIN_LEN) + *ip++;
|
||||
}
|
||||
|
||||
@@ -184,47 +216,68 @@ match:
|
||||
m_pos -= *ip++ & M3O_MASK;
|
||||
m_pos -= (lzo_uint)(*ip++) << M3O_BITS;
|
||||
#if defined(LZO_EOF_CODE)
|
||||
|
||||
if (m_pos == op)
|
||||
goto eof_found;
|
||||
|
||||
#endif
|
||||
|
||||
/* copy match */
|
||||
assert(m_pos >= out); assert(m_pos < op);
|
||||
TEST_LB(m_pos); NEED_OP(t + M3_MIN_LEN - 1);
|
||||
assert(m_pos >= out);
|
||||
assert(m_pos < op);
|
||||
TEST_LB(m_pos);
|
||||
NEED_OP(t + M3_MIN_LEN - 1);
|
||||
#if (LZO_OPT_UNALIGNED32)
|
||||
|
||||
if (t >= 2 * 4 - (M3_MIN_LEN - 1) && (op - m_pos) >= 4)
|
||||
{
|
||||
UA_COPY4(op, m_pos);
|
||||
op += 4; m_pos += 4; t -= 4 - (M3_MIN_LEN - 1);
|
||||
do {
|
||||
op += 4;
|
||||
m_pos += 4;
|
||||
t -= 4 - (M3_MIN_LEN - 1);
|
||||
|
||||
do
|
||||
{
|
||||
UA_COPY4(op, m_pos);
|
||||
op += 4; m_pos += 4; t -= 4;
|
||||
} while (t >= 4);
|
||||
if (t > 0) do *op++ = *m_pos++; while (--t > 0);
|
||||
op += 4;
|
||||
m_pos += 4;
|
||||
t -= 4;
|
||||
}
|
||||
while (t >= 4);
|
||||
|
||||
if (t > 0) do* op++ = *m_pos++;
|
||||
|
||||
while (--t > 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
COPY_M3X;
|
||||
MEMCPY_DS(op,m_pos,t);
|
||||
COPY_M3X;
|
||||
MEMCPY_DS(op, m_pos, t);
|
||||
}
|
||||
|
||||
|
||||
#if (M3O_BITS < 7)
|
||||
t = ip[-2] >> M3O_BITS;
|
||||
|
||||
if (t)
|
||||
{
|
||||
NEED_IP(t); NEED_OP(t);
|
||||
NEED_IP(t);
|
||||
NEED_OP(t);
|
||||
goto literal1;
|
||||
}
|
||||
|
||||
#elif (M3O_BITS == 7)
|
||||
|
||||
/* optimized version */
|
||||
if (ip[-2] & (1 << M3O_BITS))
|
||||
{
|
||||
NEED_IP(1); NEED_OP(1);
|
||||
NEED_IP(1);
|
||||
NEED_OP(1);
|
||||
*op++ = *ip++;
|
||||
goto literal2;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -242,7 +295,7 @@ eof_found:
|
||||
#endif
|
||||
*out_len = pd(op, out);
|
||||
return (ip == ip_end ? LZO_E_OK :
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
|
||||
|
||||
#if defined(HAVE_NEED_IP)
|
||||
|
||||
27
extern/lzo/src/lzo1b_r.ch
vendored
27
extern/lzo/src/lzo1b_r.ch
vendored
@@ -30,8 +30,8 @@
|
||||
// store a literal run (internal)
|
||||
************************************************************************/
|
||||
|
||||
LZO_LOCAL_IMPL(lzo_bytep )
|
||||
STORE_RUN ( lzo_bytep const oo, const lzo_bytep const ii, lzo_uint r_len)
|
||||
LZO_LOCAL_IMPL(lzo_bytep)
|
||||
STORE_RUN(lzo_bytep const oo, const lzo_bytep const ii, lzo_uint r_len)
|
||||
{
|
||||
lzo_bytep op;
|
||||
const lzo_bytep ip;
|
||||
@@ -52,37 +52,48 @@ STORE_RUN ( lzo_bytep const oo, const lzo_bytep const ii, lzo_uint r_len)
|
||||
while (r_len >= (t = tt))
|
||||
{
|
||||
r_len -= t;
|
||||
*op++ = 0; *op++ = (R0FAST - R0MIN) + 7;
|
||||
*op++ = 0;
|
||||
*op++ = (R0FAST - R0MIN) + 7;
|
||||
MEMCPY8_DS(op, ip, t);
|
||||
LZO_STATS(lzo_stats->r0long_runs++);
|
||||
}
|
||||
|
||||
tt >>= 1;
|
||||
do {
|
||||
|
||||
do
|
||||
{
|
||||
if (r_len >= (t = tt))
|
||||
{
|
||||
r_len -= t;
|
||||
*op++ = 0; *op++ = LZO_BYTE((R0FAST - R0MIN) + r_bits);
|
||||
*op++ = 0;
|
||||
*op++ = LZO_BYTE((R0FAST - R0MIN) + r_bits);
|
||||
MEMCPY8_DS(op, ip, t);
|
||||
LZO_STATS(lzo_stats->r0long_runs++);
|
||||
}
|
||||
|
||||
tt >>= 1;
|
||||
} while (--r_bits > 0);
|
||||
}
|
||||
while (--r_bits > 0);
|
||||
}
|
||||
|
||||
assert(r_len < 512);
|
||||
|
||||
while (r_len >= (t = R0FAST))
|
||||
{
|
||||
r_len -= t;
|
||||
*op++ = 0; *op++ = (R0FAST - R0MIN);
|
||||
*op++ = 0;
|
||||
*op++ = (R0FAST - R0MIN);
|
||||
MEMCPY8_DS(op, ip, t);
|
||||
LZO_STATS(lzo_stats->r0fast_runs++);
|
||||
}
|
||||
|
||||
t = r_len;
|
||||
|
||||
if (t >= R0MIN)
|
||||
{
|
||||
/* code a short R0 run */
|
||||
*op++ = 0; *op++ = LZO_BYTE(t - R0MIN);
|
||||
*op++ = 0;
|
||||
*op++ = LZO_BYTE(t - R0MIN);
|
||||
MEMCPY_DS(op, ip, t);
|
||||
LZO_STATS(lzo_stats->r0short_runs++);
|
||||
}
|
||||
|
||||
267
extern/lzo/src/lzo1b_sm.ch
vendored
267
extern/lzo/src/lzo1b_sm.ch
vendored
@@ -39,156 +39,181 @@
|
||||
|
||||
#if (DD_BITS == 0)
|
||||
|
||||
/* search ip in the dictionary */
|
||||
DINDEX1(dindex,ip);
|
||||
GINDEX(m_pos,m_off,dict,dindex,in);
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M3_MAX_OFFSET))
|
||||
goto literal;
|
||||
/* search ip in the dictionary */
|
||||
DINDEX1(dindex, ip);
|
||||
GINDEX(m_pos, m_off, dict, dindex, in);
|
||||
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos, m_off, in, ip, M3_MAX_OFFSET))
|
||||
goto literal;
|
||||
|
||||
#if 1
|
||||
if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
|
||||
goto try_match;
|
||||
DINDEX2(dindex,ip);
|
||||
|
||||
if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
|
||||
goto try_match;
|
||||
|
||||
DINDEX2(dindex, ip);
|
||||
#endif
|
||||
GINDEX(m_pos,m_off,dict,dindex,in);
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M3_MAX_OFFSET))
|
||||
goto literal;
|
||||
if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
|
||||
goto try_match;
|
||||
goto literal;
|
||||
GINDEX(m_pos, m_off, dict, dindex, in);
|
||||
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos, m_off, in, ip, M3_MAX_OFFSET))
|
||||
goto literal;
|
||||
|
||||
if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
|
||||
goto try_match;
|
||||
|
||||
goto literal;
|
||||
|
||||
|
||||
#else /* (DD_BITS == 0) */
|
||||
|
||||
|
||||
|
||||
/* search ip in the deepened dictionary */
|
||||
{
|
||||
lzo_dict_p d = &dict [ DINDEX(dv,ip) ];
|
||||
const lzo_bytep ip_sav;
|
||||
unsigned j = DD_SIZE;
|
||||
lzo_uint x_len;
|
||||
LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, x_off, 0);
|
||||
/* search ip in the deepened dictionary */
|
||||
{
|
||||
lzo_dict_p d = &dict [ DINDEX(dv, ip) ];
|
||||
const lzo_bytep ip_sav;
|
||||
unsigned j = DD_SIZE;
|
||||
lzo_uint x_len;
|
||||
LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, x_off, 0);
|
||||
|
||||
DVAL_ASSERT(dv,ip);
|
||||
DVAL_ASSERT(dv, ip);
|
||||
|
||||
ip_sav = ip;
|
||||
m_len = 0;
|
||||
do {
|
||||
ip_sav = ip;
|
||||
m_len = 0;
|
||||
|
||||
do
|
||||
{
|
||||
#if !defined(NDEBUG)
|
||||
const lzo_bytep z_pos = NULL;
|
||||
const lzo_bytep z_pos = NULL;
|
||||
#endif
|
||||
#if (LZO_DICT_USE_PTR)
|
||||
m_pos = *d;
|
||||
assert((z_pos = m_pos) == *d);
|
||||
m_pos = *d;
|
||||
assert((z_pos = m_pos) == *d);
|
||||
#if (LZO_DETERMINISTIC)
|
||||
assert(m_pos == NULL || m_pos >= in);
|
||||
assert(m_pos == NULL || m_pos < ip);
|
||||
assert(m_pos == NULL || m_pos >= in);
|
||||
assert(m_pos == NULL || m_pos < ip);
|
||||
#endif
|
||||
#else
|
||||
x_off = *d;
|
||||
x_off = *d;
|
||||
#endif
|
||||
assert(ip == ip_sav);
|
||||
assert(ip == ip_sav);
|
||||
|
||||
if (LZO_CHECK_MPOS(m_pos,x_off,in,ip,MAX_OFFSET))
|
||||
if (LZO_CHECK_MPOS(m_pos, x_off, in, ip, MAX_OFFSET))
|
||||
#if (CLEVEL == 9)
|
||||
*d = DENTRY(ip,in);
|
||||
*d = DENTRY(ip, in);
|
||||
|
||||
#else
|
||||
((void)(0));
|
||||
((void)(0));
|
||||
#endif
|
||||
else if (m_pos[m_len] != ip[m_len])
|
||||
((void)(0));
|
||||
else if (*m_pos++ == *ip++ && *m_pos++ == *ip++ && *m_pos++ == *ip++)
|
||||
{
|
||||
else if (m_pos[m_len] != ip[m_len])
|
||||
((void)(0));
|
||||
else if (*m_pos++ == *ip++ && *m_pos++ == *ip++ && *m_pos++ == *ip++)
|
||||
{
|
||||
#if !(LZO_DICT_USE_PTR)
|
||||
assert((z_pos = ip - 3 - x_off) == (m_pos - 3));
|
||||
assert((z_pos = ip - 3 - x_off) == (m_pos - 3));
|
||||
#endif
|
||||
/* a match */
|
||||
if (MATCH_M2)
|
||||
{
|
||||
x_len = pd((ip - 1), ip_sav);
|
||||
if (x_len > m_len)
|
||||
{
|
||||
m_len = x_len;
|
||||
m_off = x_off;
|
||||
assert((m_pos_sav = z_pos) != NULL);
|
||||
}
|
||||
|
||||
/* a match */
|
||||
if (MATCH_M2)
|
||||
{
|
||||
x_len = pd((ip - 1), ip_sav);
|
||||
|
||||
if (x_len > m_len)
|
||||
{
|
||||
m_len = x_len;
|
||||
m_off = x_off;
|
||||
assert((m_pos_sav = z_pos) != NULL);
|
||||
}
|
||||
|
||||
#if (CLEVEL == 9)
|
||||
/* try to find a closer match */
|
||||
else if (x_len == m_len && x_off < m_off)
|
||||
{
|
||||
m_off = x_off;
|
||||
assert((m_pos_sav = z_pos) != NULL);
|
||||
}
|
||||
/* try to find a closer match */
|
||||
else if (x_len == m_len && x_off < m_off)
|
||||
{
|
||||
m_off = x_off;
|
||||
assert((m_pos_sav = z_pos) != NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
assert((ip - ip_sav) == M2_MAX_LEN + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert((ip - ip_sav) == M2_MAX_LEN + 1);
|
||||
#if (CLEVEL == 9)
|
||||
#if defined(MATCH_IP_END)
|
||||
{
|
||||
const lzo_bytep end;
|
||||
end = MATCH_IP_END;
|
||||
while (ip < end && *m_pos == *ip)
|
||||
m_pos++, ip++;
|
||||
assert(ip <= in_end);
|
||||
x_len = pd(ip, ip_sav);
|
||||
}
|
||||
if (x_len > m_len)
|
||||
{
|
||||
m_len = x_len;
|
||||
m_off = x_off;
|
||||
assert((m_pos_sav = z_pos) != NULL);
|
||||
if (ip >= MATCH_IP_END)
|
||||
{
|
||||
ip = ip_sav;
|
||||
#if 0
|
||||
/* not needed - we are at the end */
|
||||
d -= DD_SIZE - j;
|
||||
assert(d == &dict [ DINDEX(dv,ip) ]);
|
||||
UPDATE_P(d,drun,ip,in);
|
||||
#endif
|
||||
goto match;
|
||||
}
|
||||
}
|
||||
else if (x_len == m_len && x_off < m_off)
|
||||
{
|
||||
m_off = x_off;
|
||||
assert((m_pos_sav = z_pos) != NULL);
|
||||
}
|
||||
#else
|
||||
/* try to find a closer match */
|
||||
if (m_len < M2_MAX_LEN + 1 || x_off < m_off)
|
||||
{
|
||||
m_len = M2_MAX_LEN + 1;
|
||||
m_off = x_off;
|
||||
assert((m_pos_sav = z_pos) != NULL);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
/* don't search for a longer/closer match */
|
||||
m_len = M2_MAX_LEN + 1;
|
||||
m_off = x_off;
|
||||
assert((m_pos_sav = z_pos) != NULL);
|
||||
ip = ip_sav;
|
||||
d -= DD_SIZE - j;
|
||||
assert(d == &dict [ DINDEX(dv,ip) ]);
|
||||
UPDATE_P(d,drun,ip,in);
|
||||
goto match;
|
||||
#endif
|
||||
}
|
||||
ip = ip_sav;
|
||||
}
|
||||
else
|
||||
ip = ip_sav;
|
||||
d++;
|
||||
} while (--j > 0);
|
||||
assert(ip == ip_sav);
|
||||
{
|
||||
const lzo_bytep end;
|
||||
end = MATCH_IP_END;
|
||||
|
||||
d -= DD_SIZE;
|
||||
assert(d == &dict [ DINDEX(dv,ip) ]);
|
||||
UPDATE_P(d,drun,ip,in);
|
||||
while (ip < end && *m_pos == *ip)
|
||||
m_pos++, ip++;
|
||||
|
||||
assert(ip <= in_end);
|
||||
x_len = pd(ip, ip_sav);
|
||||
}
|
||||
|
||||
if (x_len > m_len)
|
||||
{
|
||||
m_len = x_len;
|
||||
m_off = x_off;
|
||||
assert((m_pos_sav = z_pos) != NULL);
|
||||
|
||||
if (ip >= MATCH_IP_END)
|
||||
{
|
||||
ip = ip_sav;
|
||||
#if 0
|
||||
/* not needed - we are at the end */
|
||||
d -= DD_SIZE - j;
|
||||
assert(d == &dict [ DINDEX(dv, ip) ]);
|
||||
UPDATE_P(d, drun, ip, in);
|
||||
#endif
|
||||
goto match;
|
||||
}
|
||||
}
|
||||
else if (x_len == m_len && x_off < m_off)
|
||||
{
|
||||
m_off = x_off;
|
||||
assert((m_pos_sav = z_pos) != NULL);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* try to find a closer match */
|
||||
if (m_len < M2_MAX_LEN + 1 || x_off < m_off)
|
||||
{
|
||||
m_len = M2_MAX_LEN + 1;
|
||||
m_off = x_off;
|
||||
assert((m_pos_sav = z_pos) != NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
#else
|
||||
/* don't search for a longer/closer match */
|
||||
m_len = M2_MAX_LEN + 1;
|
||||
m_off = x_off;
|
||||
assert((m_pos_sav = z_pos) != NULL);
|
||||
ip = ip_sav;
|
||||
d -= DD_SIZE - j;
|
||||
assert(d == &dict [ DINDEX(dv, ip) ]);
|
||||
UPDATE_P(d, drun, ip, in);
|
||||
goto match;
|
||||
#endif
|
||||
}
|
||||
|
||||
ip = ip_sav;
|
||||
}
|
||||
else
|
||||
ip = ip_sav;
|
||||
|
||||
d++;
|
||||
}
|
||||
while (--j > 0);
|
||||
|
||||
assert(ip == ip_sav);
|
||||
|
||||
d -= DD_SIZE;
|
||||
assert(d == &dict [ DINDEX(dv, ip) ]);
|
||||
UPDATE_P(d, drun, ip, in);
|
||||
}
|
||||
|
||||
#endif /* (DD_BITS == 0) */
|
||||
|
||||
|
||||
47
extern/lzo/src/lzo1b_tm.ch
vendored
47
extern/lzo/src/lzo1b_tm.ch
vendored
@@ -43,39 +43,46 @@
|
||||
try_match:
|
||||
#if !defined(NDEBUG) && (LZO_DICT_USE_PTR)
|
||||
#if (LZO_DETERMINISTIC)
|
||||
assert(m_pos == NULL || m_pos >= in);
|
||||
assert(m_pos == NULL || m_pos < ip);
|
||||
assert(m_pos == NULL || m_pos >= in);
|
||||
assert(m_pos == NULL || m_pos < ip);
|
||||
#endif
|
||||
m_pos_sav = m_pos;
|
||||
m_pos_sav = m_pos;
|
||||
#endif
|
||||
if (m_pos[0] == ip[0] && m_pos[1] == ip[1] && m_pos[2] == ip[2])
|
||||
{
|
||||
m_pos += 3;
|
||||
goto match;
|
||||
}
|
||||
|
||||
if (m_pos[0] == ip[0] && m_pos[1] == ip[1] && m_pos[2] == ip[2])
|
||||
{
|
||||
m_pos += 3;
|
||||
goto match;
|
||||
}
|
||||
|
||||
|
||||
#else /* (DD_BITS == 0) */
|
||||
|
||||
|
||||
/* test potential match */
|
||||
/* test potential match */
|
||||
|
||||
if (m_len > M2_MIN_LEN)
|
||||
goto match;
|
||||
if (m_len == M2_MIN_LEN)
|
||||
{
|
||||
if (m_len > M2_MIN_LEN)
|
||||
goto match;
|
||||
|
||||
if (m_len == M2_MIN_LEN)
|
||||
{
|
||||
#if (_MAX_OFFSET == _M2_MAX_OFFSET)
|
||||
goto match;
|
||||
goto match;
|
||||
#else
|
||||
if (m_off <= M2_MAX_OFFSET)
|
||||
goto match;
|
||||
|
||||
if (m_off <= M2_MAX_OFFSET)
|
||||
goto match;
|
||||
|
||||
#if 0 && (M3_MIN_LEN == M2_MIN_LEN)
|
||||
if (ip == ii)
|
||||
goto match;
|
||||
|
||||
if (ip == ii)
|
||||
goto match;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
goto literal;
|
||||
}
|
||||
|
||||
goto literal;
|
||||
|
||||
|
||||
#endif /* (DD_BITS == 0) */
|
||||
|
||||
19
extern/lzo/src/lzo1b_xx.c
vendored
19
extern/lzo/src/lzo1b_xx.c
vendored
@@ -33,7 +33,7 @@
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
static const lzo_compress_t * const c_funcs [9] =
|
||||
static const lzo_compress_t* const c_funcs [9] =
|
||||
{
|
||||
&_lzo1b_1_compress_func,
|
||||
&_lzo1b_2_compress_func,
|
||||
@@ -49,7 +49,7 @@ static const lzo_compress_t * const c_funcs [9] =
|
||||
|
||||
static lzo_compress_t lzo1b_get_compress_func(int clevel)
|
||||
{
|
||||
const lzo_compress_t *f;
|
||||
const lzo_compress_t* f;
|
||||
|
||||
if (clevel < LZO1B_BEST_SPEED || clevel > LZO1B_BEST_COMPRESSION)
|
||||
{
|
||||
@@ -58,24 +58,27 @@ static lzo_compress_t lzo1b_get_compress_func(int clevel)
|
||||
else
|
||||
return (lzo_compress_t) 0;
|
||||
}
|
||||
f = c_funcs[clevel-1];
|
||||
|
||||
f = c_funcs[clevel - 1];
|
||||
assert(f && *f);
|
||||
return *f;
|
||||
}
|
||||
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1b_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
int clevel )
|
||||
lzo1b_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
int clevel)
|
||||
{
|
||||
lzo_compress_t f;
|
||||
|
||||
f = lzo1b_get_compress_func(clevel);
|
||||
|
||||
if (!f)
|
||||
return LZO_E_ERROR;
|
||||
return _lzo1b_do_compress(src,src_len,dst,dst_len,wrkmem,f);
|
||||
|
||||
return _lzo1b_do_compress(src, src_len, dst, dst_len, wrkmem, f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
91
extern/lzo/src/lzo1c_9x.c
vendored
91
extern/lzo/src/lzo1c_9x.c
vendored
@@ -50,7 +50,7 @@
|
||||
************************************************************************/
|
||||
|
||||
static lzo_bytep
|
||||
code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
code_match(LZO_COMPRESS_T* c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off)
|
||||
{
|
||||
if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET)
|
||||
{
|
||||
@@ -60,7 +60,7 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
m_off -= M2_MIN_OFFSET;
|
||||
/* code match len + low offset bits */
|
||||
*op++ = LZO_BYTE(((m_len - (M2_MIN_LEN - 2)) << M2O_BITS) |
|
||||
(m_off & M2O_MASK));
|
||||
(m_off & M2O_MASK));
|
||||
/* code high offset bits */
|
||||
*op++ = LZO_BYTE(m_off >> M2O_BITS);
|
||||
c->m2_m++;
|
||||
@@ -71,6 +71,7 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
assert(m_off <= M3_MAX_OFFSET);
|
||||
|
||||
m_off -= M3_MIN_OFFSET - M3_EOF_OFFSET;
|
||||
|
||||
/* code match len */
|
||||
if (m_len <= M3_MAX_LEN)
|
||||
*op++ = LZO_BYTE(M3_MARKER | (m_len - (M3_MIN_LEN - 1)));
|
||||
@@ -81,14 +82,17 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
*op++ = M4_MARKER;
|
||||
/* code match len */
|
||||
m_len -= M4_MIN_LEN - 1;
|
||||
|
||||
while (m_len > 255)
|
||||
{
|
||||
m_len -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
|
||||
assert(m_len > 0);
|
||||
*op++ = LZO_BYTE(m_len);
|
||||
}
|
||||
|
||||
/* code low offset bits */
|
||||
*op++ = LZO_BYTE(m_off & M3O_MASK);
|
||||
/* code high offset bits */
|
||||
@@ -98,6 +102,7 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
c->m3 = op;
|
||||
c->m3_m++;
|
||||
}
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
@@ -107,25 +112,25 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1c_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain );
|
||||
lzo1c_999_compress_callback(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain);
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1c_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain )
|
||||
lzo1c_999_compress_callback(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain)
|
||||
{
|
||||
lzo_bytep op;
|
||||
const lzo_bytep ii;
|
||||
lzo_uint lit;
|
||||
lzo_uint m_len, m_off;
|
||||
LZO_COMPRESS_T cc;
|
||||
LZO_COMPRESS_T * const c = &cc;
|
||||
LZO_COMPRESS_T* const c = &cc;
|
||||
lzo_swd_p const swd = (lzo_swd_p) wrkmem;
|
||||
int r;
|
||||
|
||||
@@ -144,15 +149,19 @@ lzo1c_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
c->r1_m_len = 0;
|
||||
c->m3 = out + 1; /* pointer after last m3/m4 match */
|
||||
|
||||
r = init_match(c,swd,NULL,0,0);
|
||||
r = init_match(c, swd, NULL, 0, 0);
|
||||
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
if (max_chain > 0)
|
||||
swd->max_chain = max_chain;
|
||||
|
||||
r = find_match(c,swd,0,0);
|
||||
r = find_match(c, swd, 0, 0);
|
||||
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
while (c->look > 0)
|
||||
{
|
||||
int lazy_match_min_gain = -1;
|
||||
@@ -162,18 +171,20 @@ lzo1c_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
m_off = c->m_off;
|
||||
|
||||
#if 0
|
||||
printf("%5ld: %5d len:%3d off:%5d\n", (c->ip-c->look)-in, c->look,
|
||||
m_len, m_off);
|
||||
printf("%5ld: %5d len:%3d off:%5d\n", (c->ip - c->look) - in, c->look,
|
||||
m_len, m_off);
|
||||
#endif
|
||||
|
||||
assert(c->ip - c->look >= in);
|
||||
|
||||
if (lit == 0)
|
||||
ii = c->ip - c->look;
|
||||
|
||||
assert(ii + lit == c->ip - c->look);
|
||||
assert(swd->b_char == *(c->ip - c->look));
|
||||
|
||||
if ((m_len < M2_MIN_LEN) ||
|
||||
(m_len < M3_MIN_LEN && m_off > M2_MAX_OFFSET))
|
||||
(m_len < M3_MIN_LEN && m_off > M2_MAX_OFFSET))
|
||||
{
|
||||
m_len = 0;
|
||||
}
|
||||
@@ -198,20 +209,24 @@ lzo1c_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
lazy_match_min_gain = 1;
|
||||
|
||||
#if (M2_MIN_LEN == 2)
|
||||
|
||||
if (m_len == 2)
|
||||
{
|
||||
/* don't code a match of len 2 if we have to
|
||||
code a literal run. Code a literal instead. */
|
||||
m_len = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#if (M2_MIN_LEN == M3_MIN_LEN)
|
||||
|
||||
if (m_len == M2_MIN_LEN && m_off > M2_MAX_OFFSET)
|
||||
{
|
||||
/* don't code a M3 match of len 3 if we have to
|
||||
code a literal run. Code a literal instead. */
|
||||
m_len = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@@ -229,16 +244,18 @@ lzo1c_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
/* try a lazy match */
|
||||
if (m_len == 0)
|
||||
lazy_match_min_gain = -1;
|
||||
|
||||
if (lazy_match_min_gain >= 0 && c->look > m_len)
|
||||
{
|
||||
assert(m_len > 0);
|
||||
|
||||
r = find_match(c,swd,1,0);
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
r = find_match(c, swd, 1, 0);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
assert(c->look > 0);
|
||||
|
||||
if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET &&
|
||||
c->m_off > M2_MAX_OFFSET)
|
||||
c->m_off > M2_MAX_OFFSET)
|
||||
lazy_match_min_gain += 1;
|
||||
|
||||
if (c->m_len >= m_len + lazy_match_min_gain)
|
||||
@@ -259,8 +276,10 @@ lzo1c_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
ahead = 1;
|
||||
assert(ii + lit + 1 == c->ip - c->look);
|
||||
}
|
||||
|
||||
assert(m_len > 0);
|
||||
}
|
||||
|
||||
assert(ii + lit + ahead == c->ip - c->look);
|
||||
|
||||
|
||||
@@ -268,8 +287,9 @@ lzo1c_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
{
|
||||
/* a literal */
|
||||
lit++;
|
||||
r = find_match(c,swd,1,0);
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
r = find_match(c, swd, 1, 0);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -298,21 +318,24 @@ lzo1c_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
}
|
||||
else
|
||||
{
|
||||
op = STORE_RUN(op,ii,lit);
|
||||
op = STORE_RUN(op, ii, lit);
|
||||
}
|
||||
|
||||
if (lit < R0FAST)
|
||||
c->r1_m_len = m_len;
|
||||
else
|
||||
c->r1_m_len = 0;
|
||||
|
||||
lit = 0;
|
||||
}
|
||||
else
|
||||
c->r1_m_len = 0;
|
||||
|
||||
/* 2 - code match */
|
||||
op = code_match(c,op,m_len,m_off);
|
||||
r = find_match(c,swd,m_len,1+ahead);
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
op = code_match(c, op, m_len, m_off);
|
||||
r = find_match(c, swd, m_len, 1 + ahead);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
}
|
||||
|
||||
c->codesize = pd(op, out);
|
||||
@@ -321,7 +344,7 @@ lzo1c_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
/* store final run */
|
||||
if (lit > 0)
|
||||
op = STORE_RUN(op,ii,lit);
|
||||
op = STORE_RUN(op, ii, lit);
|
||||
|
||||
#if defined(LZO_EOF_CODE)
|
||||
*op++ = M3_MARKER | 1;
|
||||
@@ -339,8 +362,8 @@ lzo1c_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
#if 0
|
||||
printf("%ld %ld -> %ld: %ld %ld %ld %ld %ld\n",
|
||||
(long) c->textsize, (long)in_len, (long) c->codesize,
|
||||
c->r1_r, c->m3_r, c->m2_m, c->m3_m, c->lazy);
|
||||
(long) c->textsize, (long)in_len, (long) c->codesize,
|
||||
c->r1_r, c->m3_r, c->m2_m, c->m3_m, c->lazy);
|
||||
#endif
|
||||
return LZO_E_OK;
|
||||
}
|
||||
@@ -352,11 +375,11 @@ lzo1c_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1c_999_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
lzo1c_999_compress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return lzo1c_999_compress_callback(in,in_len,out,out_len,wrkmem,
|
||||
return lzo1c_999_compress_callback(in, in_len, out, out_len, wrkmem,
|
||||
(lzo_callback_p) 0, 0);
|
||||
}
|
||||
|
||||
|
||||
42
extern/lzo/src/lzo1c_cc.c
vendored
42
extern/lzo/src/lzo1c_cc.c
vendored
@@ -35,10 +35,10 @@
|
||||
************************************************************************/
|
||||
|
||||
LZO_LOCAL_IMPL(int)
|
||||
_lzo1c_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_compress_t func )
|
||||
_lzo1c_do_compress(const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_compress_t func)
|
||||
{
|
||||
int r;
|
||||
#if defined(LZO_TEST_COMPRESS_OVERRUN)
|
||||
@@ -64,19 +64,22 @@ _lzo1c_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
*out_len = 0;
|
||||
r = LZO_E_NOT_COMPRESSIBLE;
|
||||
#else
|
||||
*out_len = pd(STORE_RUN(out,in,in_len), out);
|
||||
*out_len = pd(STORE_RUN(out, in, in_len), out);
|
||||
r = (*out_len > in_len) ? LZO_E_OK : LZO_E_ERROR;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
r = func(in,in_len,out,out_len,wrkmem);
|
||||
r = func(in, in_len, out, out_len, wrkmem);
|
||||
|
||||
|
||||
#if defined(LZO_EOF_CODE)
|
||||
#if defined(LZO_TEST_COMPRESS_OVERRUN)
|
||||
|
||||
if (r == LZO_E_OK && avail_out - *out_len < 3)
|
||||
r = LZO_E_COMPRESS_OVERRUN;
|
||||
|
||||
#endif
|
||||
|
||||
if (r == LZO_E_OK)
|
||||
{
|
||||
lzo_bytep op = out + *out_len;
|
||||
@@ -85,14 +88,15 @@ _lzo1c_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
op[2] = 0;
|
||||
*out_len += 3;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if (LZO_COLLECT_STATS)
|
||||
lzo_stats->out_len = *out_len;
|
||||
lzo_stats->match_bytes =
|
||||
1 * lzo_stats->m1_matches + 2 * lzo_stats->m2_matches +
|
||||
3 * lzo_stats->m3_matches + 4 * lzo_stats->m4_matches;
|
||||
1 * lzo_stats->m1_matches + 2 * lzo_stats->m2_matches +
|
||||
3 * lzo_stats->m3_matches + 4 * lzo_stats->m4_matches;
|
||||
_lzo1c_stats_calc(lzo_stats);
|
||||
#endif
|
||||
|
||||
@@ -112,30 +116,30 @@ _lzo1c_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
#if (LZO_COLLECT_STATS)
|
||||
|
||||
static lzo_stats_t lzo_statistics;
|
||||
lzo_stats_t * const lzo1c_stats = &lzo_statistics;
|
||||
lzo_stats_t* const lzo1c_stats = &lzo_statistics;
|
||||
|
||||
|
||||
void _lzo1c_stats_init(lzo_stats_t *lzo_stats)
|
||||
void _lzo1c_stats_init(lzo_stats_t* lzo_stats)
|
||||
{
|
||||
lzo_memset(lzo_stats,0,sizeof(*lzo_stats));
|
||||
lzo_memset(lzo_stats, 0, sizeof(*lzo_stats));
|
||||
}
|
||||
|
||||
|
||||
void _lzo1c_stats_calc(lzo_stats_t *lzo_stats)
|
||||
void _lzo1c_stats_calc(lzo_stats_t* lzo_stats)
|
||||
{
|
||||
lzo_stats->matches =
|
||||
lzo_stats->m1_matches + lzo_stats->m2_matches +
|
||||
lzo_stats->m3_matches + lzo_stats->m4_matches;
|
||||
lzo_stats->m1_matches + lzo_stats->m2_matches +
|
||||
lzo_stats->m3_matches + lzo_stats->m4_matches;
|
||||
|
||||
lzo_stats->literal_overhead = lzo_stats->lit_runs +
|
||||
2 * (lzo_stats->r0short_runs + lzo_stats->r0fast_runs +
|
||||
lzo_stats->r0long_runs);
|
||||
2 * (lzo_stats->r0short_runs + lzo_stats->r0fast_runs +
|
||||
lzo_stats->r0long_runs);
|
||||
lzo_stats->literal_bytes = lzo_stats->literals +
|
||||
lzo_stats->literal_overhead;
|
||||
lzo_stats->literal_overhead;
|
||||
|
||||
#if 0
|
||||
assert(lzo_stats->match_bytes + lzo_stats->literal_bytes ==
|
||||
lzo_stats->out_len);
|
||||
lzo_stats->out_len);
|
||||
#endif
|
||||
|
||||
lzo_stats->m2_matches -= lzo_stats->r1_matches;
|
||||
@@ -143,7 +147,7 @@ void _lzo1c_stats_calc(lzo_stats_t *lzo_stats)
|
||||
|
||||
if (lzo_stats->literals > 0)
|
||||
lzo_stats->literal_overhead_percent =
|
||||
100.0 * lzo_stats->literal_overhead / lzo_stats->literals;
|
||||
100.0 * lzo_stats->literal_overhead / lzo_stats->literals;
|
||||
}
|
||||
|
||||
|
||||
|
||||
14
extern/lzo/src/lzo1c_cc.h
vendored
14
extern/lzo/src/lzo1c_cc.h
vendored
@@ -57,18 +57,18 @@ extern const lzo_compress_t _lzo1c_99_compress_func;
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
LZO_LOCAL_DECL(lzo_bytep )
|
||||
_lzo1c_store_run ( lzo_bytep const oo, const lzo_bytep const ii,
|
||||
lzo_uint r_len);
|
||||
LZO_LOCAL_DECL(lzo_bytep)
|
||||
_lzo1c_store_run(lzo_bytep const oo, const lzo_bytep const ii,
|
||||
lzo_uint r_len);
|
||||
|
||||
#define STORE_RUN _lzo1c_store_run
|
||||
|
||||
|
||||
LZO_LOCAL_DECL(int)
|
||||
_lzo1c_do_compress ( const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_compress_t func );
|
||||
_lzo1c_do_compress(const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_compress_t func);
|
||||
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
12
extern/lzo/src/lzo1c_d2.c
vendored
12
extern/lzo/src/lzo1c_d2.c
vendored
@@ -35,13 +35,13 @@
|
||||
|
||||
#if defined(LZO_ARCH_I386) && defined(LZO_USE_ASM)
|
||||
LZO_EXTERN(int) lzo1c_decompress_asm_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_PUBLIC(int) lzo1c_decompress_asm_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem)
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return lzo1c_decompress_safe(src, src_len, dst, dst_len, wrkmem);
|
||||
}
|
||||
|
||||
19
extern/lzo/src/lzo1c_xx.c
vendored
19
extern/lzo/src/lzo1c_xx.c
vendored
@@ -33,7 +33,7 @@
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
static const lzo_compress_t * const c_funcs [9] =
|
||||
static const lzo_compress_t* const c_funcs [9] =
|
||||
{
|
||||
&_lzo1c_1_compress_func,
|
||||
&_lzo1c_2_compress_func,
|
||||
@@ -49,7 +49,7 @@ static const lzo_compress_t * const c_funcs [9] =
|
||||
|
||||
static lzo_compress_t lzo1c_get_compress_func(int clevel)
|
||||
{
|
||||
const lzo_compress_t *f;
|
||||
const lzo_compress_t* f;
|
||||
|
||||
if (clevel < LZO1C_BEST_SPEED || clevel > LZO1C_BEST_COMPRESSION)
|
||||
{
|
||||
@@ -58,24 +58,27 @@ static lzo_compress_t lzo1c_get_compress_func(int clevel)
|
||||
else
|
||||
return (lzo_compress_t) 0;
|
||||
}
|
||||
f = c_funcs[clevel-1];
|
||||
|
||||
f = c_funcs[clevel - 1];
|
||||
assert(f && *f);
|
||||
return *f;
|
||||
}
|
||||
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1c_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
int clevel )
|
||||
lzo1c_compress(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
int clevel)
|
||||
{
|
||||
lzo_compress_t f;
|
||||
|
||||
f = lzo1c_get_compress_func(clevel);
|
||||
|
||||
if (!f)
|
||||
return LZO_E_ERROR;
|
||||
return _lzo1c_do_compress(src,src_len,dst,dst_len,wrkmem,f);
|
||||
|
||||
return _lzo1c_do_compress(src, src_len, dst, dst_len, wrkmem, f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
94
extern/lzo/src/lzo1f_1.c
vendored
94
extern/lzo/src/lzo1f_1.c
vendored
@@ -53,9 +53,9 @@
|
||||
************************************************************************/
|
||||
|
||||
static __lzo_noinline
|
||||
int do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
int do_compress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
const lzo_bytep ip;
|
||||
lzo_bytep op;
|
||||
@@ -69,6 +69,7 @@ int do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
ii = ip;
|
||||
|
||||
ip++;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
const lzo_bytep m_pos;
|
||||
@@ -77,25 +78,33 @@ int do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_uint dindex;
|
||||
lzo_uint lit;
|
||||
|
||||
DINDEX1(dindex,ip);
|
||||
GINDEX(m_pos,m_off,dict,dindex,in);
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M3_MAX_OFFSET))
|
||||
DINDEX1(dindex, ip);
|
||||
GINDEX(m_pos, m_off, dict, dindex, in);
|
||||
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos, m_off, in, ip, M3_MAX_OFFSET))
|
||||
goto literal;
|
||||
|
||||
#if 1
|
||||
|
||||
if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
|
||||
goto try_match;
|
||||
DINDEX2(dindex,ip);
|
||||
|
||||
DINDEX2(dindex, ip);
|
||||
#endif
|
||||
GINDEX(m_pos,m_off,dict,dindex,in);
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M3_MAX_OFFSET))
|
||||
GINDEX(m_pos, m_off, dict, dindex, in);
|
||||
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos, m_off, in, ip, M3_MAX_OFFSET))
|
||||
goto literal;
|
||||
|
||||
if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
|
||||
goto try_match;
|
||||
|
||||
goto literal;
|
||||
|
||||
|
||||
try_match:
|
||||
#if 0 && (LZO_OPT_UNALIGNED16)
|
||||
|
||||
if (UA_GET_NE16(m_pos) != UA_GET_NE16(ip))
|
||||
#else
|
||||
if (m_pos[0] != ip[0] || m_pos[1] != ip[1])
|
||||
@@ -108,16 +117,23 @@ try_match:
|
||||
{
|
||||
m_pos += 3;
|
||||
#if 0
|
||||
|
||||
if (m_off <= M2_MAX_OFFSET)
|
||||
goto match;
|
||||
|
||||
if (lit <= 3)
|
||||
goto match;
|
||||
|
||||
if (lit == 3) /* better compression, but slower */
|
||||
{
|
||||
assert(op - 2 > out); op[-2] |= LZO_BYTE(3);
|
||||
*op++ = *ii++; *op++ = *ii++; *op++ = *ii++;
|
||||
assert(op - 2 > out);
|
||||
op[-2] |= LZO_BYTE(3);
|
||||
*op++ = *ii++;
|
||||
*op++ = *ii++;
|
||||
*op++ = *ii++;
|
||||
goto code_match;
|
||||
}
|
||||
|
||||
if (*m_pos == ip[3])
|
||||
#endif
|
||||
goto match;
|
||||
@@ -125,19 +141,22 @@ try_match:
|
||||
}
|
||||
|
||||
|
||||
/* a literal */
|
||||
/* a literal */
|
||||
literal:
|
||||
UPDATE_I(dict,0,dindex,ip,in);
|
||||
UPDATE_I(dict, 0, dindex, ip, in);
|
||||
|
||||
if (++ip >= ip_end)
|
||||
break;
|
||||
|
||||
continue;
|
||||
|
||||
|
||||
/* a match */
|
||||
/* a match */
|
||||
match:
|
||||
UPDATE_I(dict,0,dindex,ip,in);
|
||||
UPDATE_I(dict, 0, dindex, ip, in);
|
||||
/* store current literal run */
|
||||
lit = pd(ip,ii);
|
||||
lit = pd(ip, ii);
|
||||
|
||||
if (lit > 0)
|
||||
{
|
||||
lzo_uint t = lit;
|
||||
@@ -151,28 +170,36 @@ match:
|
||||
lzo_uint tt = t - 31;
|
||||
|
||||
*op++ = 0;
|
||||
|
||||
while (tt > 255)
|
||||
{
|
||||
tt -= 255;
|
||||
UA_SET1(op, 0);
|
||||
op++;
|
||||
}
|
||||
|
||||
assert(tt > 0);
|
||||
*op++ = LZO_BYTE(tt);
|
||||
}
|
||||
do *op++ = *ii++; while (--t > 0);
|
||||
|
||||
do* op++ = *ii++;
|
||||
|
||||
while (--t > 0);
|
||||
}
|
||||
|
||||
assert(ii == ip);
|
||||
|
||||
|
||||
/* code the match */
|
||||
ip += 3;
|
||||
|
||||
if (*m_pos++ != *ip++ || *m_pos++ != *ip++ || *m_pos++ != *ip++ ||
|
||||
*m_pos++ != *ip++ || *m_pos++ != *ip++ || *m_pos++ != *ip++)
|
||||
*m_pos++ != *ip++ || *m_pos++ != *ip++ || *m_pos++ != *ip++)
|
||||
{
|
||||
--ip;
|
||||
m_len = pd(ip, ii);
|
||||
assert(m_len >= 3); assert(m_len <= 8);
|
||||
assert(m_len >= 3);
|
||||
assert(m_len <= 8);
|
||||
|
||||
if (m_off <= M2_MAX_OFFSET)
|
||||
{
|
||||
@@ -180,7 +207,7 @@ match:
|
||||
*op++ = LZO_BYTE(((m_len - 2) << 5) | ((m_off & 7) << 2));
|
||||
*op++ = LZO_BYTE(m_off >> 3);
|
||||
}
|
||||
else if (m_len == 3 && m_off <= 2*M2_MAX_OFFSET && lit > 0)
|
||||
else if (m_len == 3 && m_off <= 2 * M2_MAX_OFFSET && lit > 0)
|
||||
{
|
||||
m_off -= 1;
|
||||
/* m_off -= M2_MAX_OFFSET; */
|
||||
@@ -199,8 +226,10 @@ match:
|
||||
{
|
||||
const lzo_bytep end;
|
||||
end = in_end;
|
||||
|
||||
while (ip < end && *m_pos == *ip)
|
||||
m_pos++, ip++;
|
||||
|
||||
m_len = pd(ip, ii);
|
||||
}
|
||||
assert(m_len >= 3);
|
||||
@@ -211,29 +240,33 @@ match:
|
||||
{
|
||||
m_len -= 33;
|
||||
*op++ = M3_MARKER | 0;
|
||||
|
||||
while (m_len > 255)
|
||||
{
|
||||
m_len -= 255;
|
||||
UA_SET1(op, 0);
|
||||
op++;
|
||||
}
|
||||
|
||||
assert(m_len > 0);
|
||||
*op++ = LZO_BYTE(m_len);
|
||||
}
|
||||
|
||||
*op++ = LZO_BYTE((m_off & 63) << 2);
|
||||
*op++ = LZO_BYTE(m_off >> 6);
|
||||
}
|
||||
|
||||
ii = ip;
|
||||
|
||||
if (ip >= ip_end)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* store final literal run */
|
||||
if (pd(in_end,ii) > 0)
|
||||
if (pd(in_end, ii) > 0)
|
||||
{
|
||||
lzo_uint t = pd(in_end,ii);
|
||||
lzo_uint t = pd(in_end, ii);
|
||||
|
||||
if (t < 4 && op > out)
|
||||
op[-2] = LZO_BYTE(op[-2] | t);
|
||||
@@ -244,15 +277,18 @@ match:
|
||||
lzo_uint tt = t - 31;
|
||||
|
||||
*op++ = 0;
|
||||
|
||||
while (tt > 255)
|
||||
{
|
||||
tt -= 255;
|
||||
UA_SET1(op, 0);
|
||||
op++;
|
||||
}
|
||||
|
||||
assert(tt > 0);
|
||||
*op++ = LZO_BYTE(tt);
|
||||
}
|
||||
|
||||
UA_COPYN(op, ii, t);
|
||||
op += t;
|
||||
}
|
||||
@@ -267,9 +303,9 @@ match:
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1f_1_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
lzo1f_1_compress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
lzo_bytep op = out;
|
||||
int r = LZO_E_OK;
|
||||
@@ -279,11 +315,15 @@ lzo1f_1_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
else if (in_len <= 10)
|
||||
{
|
||||
*op++ = LZO_BYTE(in_len);
|
||||
do *op++ = *in++; while (--in_len > 0);
|
||||
|
||||
do* op++ = *in++;
|
||||
|
||||
while (--in_len > 0);
|
||||
|
||||
*out_len = pd(op, out);
|
||||
}
|
||||
else
|
||||
r = do_compress(in,in_len,out,out_len,wrkmem);
|
||||
r = do_compress(in, in_len, out, out_len, wrkmem);
|
||||
|
||||
if (r == LZO_E_OK)
|
||||
{
|
||||
|
||||
85
extern/lzo/src/lzo1f_9x.c
vendored
85
extern/lzo/src/lzo1f_9x.c
vendored
@@ -50,7 +50,7 @@
|
||||
************************************************************************/
|
||||
|
||||
static lzo_bytep
|
||||
code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
code_match(LZO_COMPRESS_T* c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off)
|
||||
{
|
||||
if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET)
|
||||
{
|
||||
@@ -76,14 +76,17 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
{
|
||||
m_len -= M3_MAX_LEN;
|
||||
*op++ = M3_MARKER | 0;
|
||||
|
||||
while (m_len > 255)
|
||||
{
|
||||
m_len -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
|
||||
assert(m_len > 0);
|
||||
*op++ = LZO_BYTE(m_len);
|
||||
}
|
||||
|
||||
*op++ = LZO_BYTE((m_off & 63) << 2);
|
||||
*op++ = LZO_BYTE(m_off >> 6);
|
||||
c->m3_m++;
|
||||
@@ -94,7 +97,7 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
|
||||
|
||||
static lzo_bytep
|
||||
STORE_RUN ( lzo_bytep op, const lzo_bytep ii, lzo_uint t, lzo_bytep out )
|
||||
STORE_RUN(lzo_bytep op, const lzo_bytep ii, lzo_uint t, lzo_bytep out)
|
||||
{
|
||||
if (t < 4 && op > out)
|
||||
op[-2] = LZO_BYTE(op[-2] | t);
|
||||
@@ -105,15 +108,20 @@ STORE_RUN ( lzo_bytep op, const lzo_bytep ii, lzo_uint t, lzo_bytep out )
|
||||
lzo_uint tt = t - 31;
|
||||
|
||||
*op++ = 0;
|
||||
|
||||
while (tt > 255)
|
||||
{
|
||||
tt -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
|
||||
assert(tt > 0);
|
||||
*op++ = LZO_BYTE(tt);
|
||||
}
|
||||
do *op++ = *ii++; while (--t > 0);
|
||||
|
||||
do* op++ = *ii++;
|
||||
|
||||
while (--t > 0);
|
||||
|
||||
return op;
|
||||
}
|
||||
@@ -124,25 +132,25 @@ STORE_RUN ( lzo_bytep op, const lzo_bytep ii, lzo_uint t, lzo_bytep out )
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo1f_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain );
|
||||
lzo1f_999_compress_callback(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain);
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1f_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain )
|
||||
lzo1f_999_compress_callback(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain)
|
||||
{
|
||||
lzo_bytep op;
|
||||
const lzo_bytep ii;
|
||||
lzo_uint lit;
|
||||
lzo_uint m_len, m_off;
|
||||
LZO_COMPRESS_T cc;
|
||||
LZO_COMPRESS_T * const c = &cc;
|
||||
LZO_COMPRESS_T* const c = &cc;
|
||||
lzo_swd_p const swd = (lzo_swd_p) wrkmem;
|
||||
int r;
|
||||
|
||||
@@ -160,15 +168,19 @@ lzo1f_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
lit = 0;
|
||||
c->r1_lit = c->r1_m_len = 0;
|
||||
|
||||
r = init_match(c,swd,NULL,0,0);
|
||||
r = init_match(c, swd, NULL, 0, 0);
|
||||
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
if (max_chain > 0)
|
||||
swd->max_chain = max_chain;
|
||||
|
||||
r = find_match(c,swd,0,0);
|
||||
r = find_match(c, swd, 0, 0);
|
||||
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
while (c->look > 0)
|
||||
{
|
||||
int lazy_match_min_gain = -1;
|
||||
@@ -178,13 +190,15 @@ lzo1f_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
m_off = c->m_off;
|
||||
|
||||
assert(c->ip - c->look >= in);
|
||||
|
||||
if (lit == 0)
|
||||
ii = c->ip - c->look;
|
||||
|
||||
assert(ii + lit == c->ip - c->look);
|
||||
assert(swd->b_char == *(c->ip - c->look));
|
||||
|
||||
if ((m_len < M2_MIN_LEN) ||
|
||||
(m_len < M3_MIN_LEN && m_off > M2_MAX_OFFSET))
|
||||
(m_len < M3_MIN_LEN && m_off > M2_MAX_OFFSET))
|
||||
{
|
||||
m_len = 0;
|
||||
}
|
||||
@@ -208,12 +222,13 @@ lzo1f_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
/* try a lazy match */
|
||||
if (m_len > 0 && lazy_match_min_gain >= 0 && c->look > m_len)
|
||||
{
|
||||
r = find_match(c,swd,1,0);
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
r = find_match(c, swd, 1, 0);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
assert(c->look > 0);
|
||||
|
||||
if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET &&
|
||||
c->m_off > M2_MAX_OFFSET)
|
||||
c->m_off > M2_MAX_OFFSET)
|
||||
{
|
||||
lazy_match_min_gain += 1;
|
||||
}
|
||||
@@ -250,8 +265,10 @@ lzo1f_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
ahead = 1;
|
||||
assert(ii + lit + 1 == c->ip - c->look);
|
||||
}
|
||||
|
||||
assert(m_len > 0);
|
||||
}
|
||||
|
||||
assert(ii + lit + ahead == c->ip - c->look);
|
||||
|
||||
|
||||
@@ -259,15 +276,16 @@ lzo1f_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
{
|
||||
/* a literal */
|
||||
lit++;
|
||||
r = find_match(c,swd,1,0);
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
r = find_match(c, swd, 1, 0);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 1 - store run */
|
||||
if (lit > 0)
|
||||
{
|
||||
op = STORE_RUN(op,ii,lit,out);
|
||||
op = STORE_RUN(op, ii, lit, out);
|
||||
c->r1_m_len = m_len;
|
||||
c->r1_lit = lit;
|
||||
lit = 0;
|
||||
@@ -276,9 +294,10 @@ lzo1f_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
c->r1_lit = c->r1_m_len = 0;
|
||||
|
||||
/* 2 - code match */
|
||||
op = code_match(c,op,m_len,m_off);
|
||||
r = find_match(c,swd,m_len,1+ahead);
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
op = code_match(c, op, m_len, m_off);
|
||||
r = find_match(c, swd, m_len, 1 + ahead);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
}
|
||||
|
||||
c->codesize = pd(op, out);
|
||||
@@ -287,7 +306,7 @@ lzo1f_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
/* store final run */
|
||||
if (lit > 0)
|
||||
op = STORE_RUN(op,ii,lit,out);
|
||||
op = STORE_RUN(op, ii, lit, out);
|
||||
|
||||
#if defined(LZO_EOF_CODE)
|
||||
*op++ = M3_MARKER | 1;
|
||||
@@ -305,8 +324,8 @@ lzo1f_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
#if 0
|
||||
printf("%ld %ld -> %ld: %ld %ld %ld %ld\n",
|
||||
(long) c->textsize, (long)in_len, (long) c->codesize,
|
||||
c->r1_r, c->m2_m, c->m3_m, c->lazy);
|
||||
(long) c->textsize, (long)in_len, (long) c->codesize,
|
||||
c->r1_r, c->m2_m, c->m3_m, c->lazy);
|
||||
#endif
|
||||
return LZO_E_OK;
|
||||
}
|
||||
@@ -318,11 +337,11 @@ lzo1f_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1f_999_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
lzo1f_999_compress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return lzo1f_999_compress_callback(in,in_len,out,out_len,wrkmem,
|
||||
return lzo1f_999_compress_callback(in, in_len, out, out_len, wrkmem,
|
||||
(lzo_callback_p) 0, 0);
|
||||
}
|
||||
|
||||
|
||||
98
extern/lzo/src/lzo1f_d.ch
vendored
98
extern/lzo/src/lzo1f_d.ch
vendored
@@ -34,9 +34,9 @@
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
DO_DECOMPRESS(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
lzo_bytep op;
|
||||
const lzo_bytep ip;
|
||||
@@ -58,6 +58,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
while (TEST_IP_AND_TEST_OP)
|
||||
{
|
||||
t = *ip++;
|
||||
|
||||
if (t > 31)
|
||||
goto match;
|
||||
|
||||
@@ -65,6 +66,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
if (t == 0)
|
||||
{
|
||||
NEED_IP(1);
|
||||
|
||||
while (*ip == 0)
|
||||
{
|
||||
t += 255;
|
||||
@@ -72,22 +74,36 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
TEST_IV(t);
|
||||
NEED_IP(1);
|
||||
}
|
||||
|
||||
t += 31 + *ip++;
|
||||
}
|
||||
|
||||
/* copy literals */
|
||||
assert(t > 0); NEED_OP(t); NEED_IP(t+1);
|
||||
assert(t > 0);
|
||||
NEED_OP(t);
|
||||
NEED_IP(t + 1);
|
||||
#if (LZO_OPT_UNALIGNED32)
|
||||
|
||||
if (t >= 4)
|
||||
{
|
||||
do {
|
||||
do
|
||||
{
|
||||
UA_COPY4(op, ip);
|
||||
op += 4; ip += 4; t -= 4;
|
||||
} while (t >= 4);
|
||||
if (t > 0) do *op++ = *ip++; while (--t > 0);
|
||||
op += 4;
|
||||
ip += 4;
|
||||
t -= 4;
|
||||
}
|
||||
while (t >= 4);
|
||||
|
||||
if (t > 0) do* op++ = *ip++;
|
||||
|
||||
while (--t > 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
do *op++ = *ip++; while (--t > 0);
|
||||
do* op++ = *ip++;
|
||||
|
||||
while (--t > 0);
|
||||
|
||||
t = *ip++;
|
||||
|
||||
@@ -99,27 +115,35 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
m_pos = op - 1 - 0x800;
|
||||
m_pos -= (t >> 2) & 7;
|
||||
m_pos -= *ip++ << 3;
|
||||
TEST_LB(m_pos); NEED_OP(3);
|
||||
*op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos++;
|
||||
TEST_LB(m_pos);
|
||||
NEED_OP(3);
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
match:
|
||||
|
||||
if (t < M3_MARKER)
|
||||
{
|
||||
m_pos = op - 1;
|
||||
m_pos -= (t >> 2) & 7;
|
||||
m_pos -= *ip++ << 3;
|
||||
t >>= 5;
|
||||
TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
|
||||
TEST_LB(m_pos);
|
||||
assert(t > 0);
|
||||
NEED_OP(t + 3 - 1);
|
||||
goto copy_match;
|
||||
}
|
||||
else
|
||||
{
|
||||
t &= 31;
|
||||
|
||||
if (t == 0)
|
||||
{
|
||||
NEED_IP(1);
|
||||
|
||||
while (*ip == 0)
|
||||
{
|
||||
t += 255;
|
||||
@@ -127,8 +151,10 @@ match:
|
||||
TEST_OV(t);
|
||||
NEED_IP(1);
|
||||
}
|
||||
|
||||
t += 31 + *ip++;
|
||||
}
|
||||
|
||||
NEED_IP(2);
|
||||
m_pos = op;
|
||||
#if (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN)
|
||||
@@ -138,38 +164,64 @@ match:
|
||||
m_pos -= *ip++ >> 2;
|
||||
m_pos -= *ip++ << 6;
|
||||
#endif
|
||||
|
||||
if (m_pos == op)
|
||||
goto eof_found;
|
||||
}
|
||||
|
||||
/* copy match */
|
||||
TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
|
||||
TEST_LB(m_pos);
|
||||
assert(t > 0);
|
||||
NEED_OP(t + 3 - 1);
|
||||
#if (LZO_OPT_UNALIGNED32)
|
||||
|
||||
if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4)
|
||||
{
|
||||
UA_COPY4(op, m_pos);
|
||||
op += 4; m_pos += 4; t -= 4 - (3 - 1);
|
||||
do {
|
||||
op += 4;
|
||||
m_pos += 4;
|
||||
t -= 4 - (3 - 1);
|
||||
|
||||
do
|
||||
{
|
||||
UA_COPY4(op, m_pos);
|
||||
op += 4; m_pos += 4; t -= 4;
|
||||
} while (t >= 4);
|
||||
if (t > 0) do *op++ = *m_pos++; while (--t > 0);
|
||||
op += 4;
|
||||
m_pos += 4;
|
||||
t -= 4;
|
||||
}
|
||||
while (t >= 4);
|
||||
|
||||
if (t > 0) do* op++ = *m_pos++;
|
||||
|
||||
while (--t > 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
copy_match:
|
||||
*op++ = *m_pos++; *op++ = *m_pos++;
|
||||
do *op++ = *m_pos++; while (--t > 0);
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
|
||||
do* op++ = *m_pos++;
|
||||
|
||||
while (--t > 0);
|
||||
}
|
||||
}
|
||||
|
||||
t = ip[-2] & 3;
|
||||
|
||||
if (t == 0)
|
||||
break;
|
||||
|
||||
/* copy literals */
|
||||
assert(t > 0); NEED_OP(t); NEED_IP(t+1);
|
||||
do *op++ = *ip++; while (--t > 0);
|
||||
assert(t > 0);
|
||||
NEED_OP(t);
|
||||
NEED_IP(t + 1);
|
||||
|
||||
do* op++ = *ip++;
|
||||
|
||||
while (--t > 0);
|
||||
|
||||
t = *ip++;
|
||||
}
|
||||
}
|
||||
@@ -184,7 +236,7 @@ eof_found:
|
||||
assert(t == 1);
|
||||
*out_len = pd(op, out);
|
||||
return (ip == ip_end ? LZO_E_OK :
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
|
||||
|
||||
#if defined(HAVE_NEED_IP)
|
||||
|
||||
12
extern/lzo/src/lzo1f_d2.c
vendored
12
extern/lzo/src/lzo1f_d2.c
vendored
@@ -35,13 +35,13 @@
|
||||
|
||||
#if defined(LZO_ARCH_I386) && defined(LZO_USE_ASM)
|
||||
LZO_EXTERN(int) lzo1f_decompress_asm_fast_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_PUBLIC(int) lzo1f_decompress_asm_fast_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem)
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return lzo1f_decompress_safe(src, src_len, dst, dst_len, wrkmem);
|
||||
}
|
||||
|
||||
326
extern/lzo/src/lzo1x_9x.c
vendored
326
extern/lzo/src/lzo1x_9x.c
vendored
@@ -86,17 +86,17 @@
|
||||
|
||||
/* this is a public functions, but there is no prototype in a header file */
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_999_compress_internal ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len,
|
||||
lzo_callback_p cb,
|
||||
int try_lazy_parm,
|
||||
lzo_uint good_length,
|
||||
lzo_uint max_lazy,
|
||||
lzo_uint nice_length,
|
||||
lzo_uint max_chain,
|
||||
lzo_uint32_t flags );
|
||||
lzo1x_999_compress_internal(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len,
|
||||
lzo_callback_p cb,
|
||||
int try_lazy_parm,
|
||||
lzo_uint good_length,
|
||||
lzo_uint max_lazy,
|
||||
lzo_uint nice_length,
|
||||
lzo_uint max_chain,
|
||||
lzo_uint32_t flags);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -104,7 +104,7 @@ lzo1x_999_compress_internal ( const lzo_bytep in , lzo_uint in_len,
|
||||
************************************************************************/
|
||||
|
||||
static lzo_bytep
|
||||
code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
code_match(LZO_COMPRESS_T* c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off)
|
||||
{
|
||||
lzo_uint x_len = m_len;
|
||||
lzo_uint x_off = m_off;
|
||||
@@ -112,38 +112,40 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
c->match_bytes += m_len;
|
||||
|
||||
#if 0
|
||||
/*
|
||||
static lzo_uint last_m_len = 0, last_m_off = 0;
|
||||
static lzo_uint prev_m_off[4];
|
||||
static unsigned prev_m_off_ptr = 0;
|
||||
unsigned i;
|
||||
/*
|
||||
static lzo_uint last_m_len = 0, last_m_off = 0;
|
||||
static lzo_uint prev_m_off[4];
|
||||
static unsigned prev_m_off_ptr = 0;
|
||||
unsigned i;
|
||||
|
||||
//if (m_len >= 3 && m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET)
|
||||
if (m_len >= 3 && m_len <= M2_MAX_LEN)
|
||||
{
|
||||
//if (m_len == last_m_len && m_off == last_m_off)
|
||||
//printf("last_m_len + last_m_off\n");
|
||||
//else
|
||||
if (m_off == last_m_off)
|
||||
printf("last_m_off\n");
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
if (m_off == prev_m_off[i])
|
||||
printf("prev_m_off %u: %5ld\n",i,(long)m_off);
|
||||
}
|
||||
}
|
||||
last_m_len = m_len;
|
||||
last_m_off = prev_m_off[prev_m_off_ptr] = m_off;
|
||||
prev_m_off_ptr = (prev_m_off_ptr + 1) & 3;
|
||||
*/
|
||||
//if (m_len >= 3 && m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET)
|
||||
if (m_len >= 3 && m_len <= M2_MAX_LEN)
|
||||
{
|
||||
//if (m_len == last_m_len && m_off == last_m_off)
|
||||
//printf("last_m_len + last_m_off\n");
|
||||
//else
|
||||
if (m_off == last_m_off)
|
||||
printf("last_m_off\n");
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
if (m_off == prev_m_off[i])
|
||||
printf("prev_m_off %u: %5ld\n",i,(long)m_off);
|
||||
}
|
||||
}
|
||||
last_m_len = m_len;
|
||||
last_m_off = prev_m_off[prev_m_off_ptr] = m_off;
|
||||
prev_m_off_ptr = (prev_m_off_ptr + 1) & 3;
|
||||
*/
|
||||
#endif
|
||||
|
||||
assert(op > c->out);
|
||||
|
||||
if (m_len == 2)
|
||||
{
|
||||
assert(m_off <= M1_MAX_OFFSET);
|
||||
assert(c->r1_lit > 0); assert(c->r1_lit < 4);
|
||||
assert(c->r1_lit > 0);
|
||||
assert(c->r1_lit < 4);
|
||||
m_off -= 1;
|
||||
#if defined(LZO1Z)
|
||||
*op++ = LZO_BYTE(M1_MARKER | (m_off >> 6));
|
||||
@@ -154,6 +156,7 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
#endif
|
||||
c->m1a_m++;
|
||||
}
|
||||
|
||||
#if defined(LZO1Z)
|
||||
else if (m_len <= M2_MAX_LEN && (m_off <= M2_MAX_OFFSET || m_off == c->last_m_off))
|
||||
#else
|
||||
@@ -172,6 +175,7 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
*op++ = LZO_BYTE(m_off >> 2);
|
||||
assert(op[-2] >= M2_MARKER);
|
||||
#elif defined(LZO1Z)
|
||||
|
||||
if (m_off == c->last_m_off)
|
||||
*op++ = LZO_BYTE(((m_len - 1) << 5) | (0x700 >> 6));
|
||||
else
|
||||
@@ -180,6 +184,7 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
*op++ = LZO_BYTE(((m_len - 1) << 5) | (m_off >> 6));
|
||||
*op++ = LZO_BYTE(m_off << 2);
|
||||
}
|
||||
|
||||
#endif
|
||||
c->m2_m++;
|
||||
}
|
||||
@@ -201,20 +206,24 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
{
|
||||
assert(m_len >= 3);
|
||||
m_off -= 1;
|
||||
|
||||
if (m_len <= M3_MAX_LEN)
|
||||
*op++ = LZO_BYTE(M3_MARKER | (m_len - 2));
|
||||
else
|
||||
{
|
||||
m_len -= M3_MAX_LEN;
|
||||
*op++ = M3_MARKER | 0;
|
||||
|
||||
while (m_len > 255)
|
||||
{
|
||||
m_len -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
|
||||
assert(m_len > 0);
|
||||
*op++ = LZO_BYTE(m_len);
|
||||
}
|
||||
|
||||
#if defined(LZO1Z)
|
||||
*op++ = LZO_BYTE(m_off >> 6);
|
||||
*op++ = LZO_BYTE(m_off << 2);
|
||||
@@ -229,23 +238,28 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
lzo_uint k;
|
||||
|
||||
assert(m_len >= 3);
|
||||
assert(m_off > 0x4000); assert(m_off <= 0xbfff);
|
||||
assert(m_off > 0x4000);
|
||||
assert(m_off <= 0xbfff);
|
||||
m_off -= 0x4000;
|
||||
k = (m_off & 0x4000) >> 11;
|
||||
|
||||
if (m_len <= M4_MAX_LEN)
|
||||
*op++ = LZO_BYTE(M4_MARKER | k | (m_len - 2));
|
||||
else
|
||||
{
|
||||
m_len -= M4_MAX_LEN;
|
||||
*op++ = LZO_BYTE(M4_MARKER | k | 0);
|
||||
|
||||
while (m_len > 255)
|
||||
{
|
||||
m_len -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
|
||||
assert(m_len > 0);
|
||||
*op++ = LZO_BYTE(m_len);
|
||||
}
|
||||
|
||||
#if defined(LZO1Z)
|
||||
*op++ = LZO_BYTE(m_off >> 6);
|
||||
*op++ = LZO_BYTE(m_off << 2);
|
||||
@@ -263,7 +277,7 @@ code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off )
|
||||
|
||||
|
||||
static lzo_bytep
|
||||
STORE_RUN ( LZO_COMPRESS_T *c, lzo_bytep op, const lzo_bytep ii, lzo_uint t )
|
||||
STORE_RUN(LZO_COMPRESS_T* c, lzo_bytep op, const lzo_bytep ii, lzo_uint t)
|
||||
{
|
||||
c->lit_bytes += t;
|
||||
|
||||
@@ -290,29 +304,34 @@ STORE_RUN ( LZO_COMPRESS_T *c, lzo_bytep op, const lzo_bytep ii, lzo_uint t )
|
||||
lzo_uint tt = t - 18;
|
||||
|
||||
*op++ = 0;
|
||||
|
||||
while (tt > 255)
|
||||
{
|
||||
tt -= 255;
|
||||
*op++ = 0;
|
||||
}
|
||||
|
||||
assert(tt > 0);
|
||||
*op++ = LZO_BYTE(tt);
|
||||
c->lit3_r++;
|
||||
}
|
||||
do *op++ = *ii++; while (--t > 0);
|
||||
|
||||
do* op++ = *ii++;
|
||||
|
||||
while (--t > 0);
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
|
||||
static lzo_bytep
|
||||
code_run ( LZO_COMPRESS_T *c, lzo_bytep op, const lzo_bytep ii,
|
||||
lzo_uint lit, lzo_uint m_len )
|
||||
code_run(LZO_COMPRESS_T* c, lzo_bytep op, const lzo_bytep ii,
|
||||
lzo_uint lit, lzo_uint m_len)
|
||||
{
|
||||
if (lit > 0)
|
||||
{
|
||||
assert(m_len >= 2);
|
||||
op = STORE_RUN(c,op,ii,lit);
|
||||
op = STORE_RUN(c, op, ii, lit);
|
||||
c->r1_m_len = m_len;
|
||||
c->r1_lit = lit;
|
||||
}
|
||||
@@ -332,42 +351,54 @@ code_run ( LZO_COMPRESS_T *c, lzo_bytep op, const lzo_bytep ii,
|
||||
************************************************************************/
|
||||
|
||||
static lzo_uint
|
||||
len_of_coded_match ( lzo_uint m_len, lzo_uint m_off, lzo_uint lit )
|
||||
len_of_coded_match(lzo_uint m_len, lzo_uint m_off, lzo_uint lit)
|
||||
{
|
||||
lzo_uint n = 4;
|
||||
|
||||
if (m_len < 2)
|
||||
return 0;
|
||||
|
||||
if (m_len == 2)
|
||||
return (m_off <= M1_MAX_OFFSET && lit > 0 && lit < 4) ? 2 : 0;
|
||||
|
||||
if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET)
|
||||
return 2;
|
||||
|
||||
if (m_len == M2_MIN_LEN && m_off <= MX_MAX_OFFSET && lit >= 4)
|
||||
return 2;
|
||||
|
||||
if (m_off <= M3_MAX_OFFSET)
|
||||
{
|
||||
if (m_len <= M3_MAX_LEN)
|
||||
return 3;
|
||||
|
||||
m_len -= M3_MAX_LEN;
|
||||
|
||||
while (m_len > 255)
|
||||
{
|
||||
m_len -= 255;
|
||||
n++;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
if (m_off <= M4_MAX_OFFSET)
|
||||
{
|
||||
if (m_len <= M4_MAX_LEN)
|
||||
return 3;
|
||||
|
||||
m_len -= M4_MAX_LEN;
|
||||
|
||||
while (m_len > 255)
|
||||
{
|
||||
m_len -= 255;
|
||||
n++;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -377,12 +408,14 @@ min_gain(lzo_uint ahead, lzo_uint lit1, lzo_uint lit2, lzo_uint l1, lzo_uint l2,
|
||||
{
|
||||
lzo_uint lazy_match_min_gain;
|
||||
|
||||
assert (ahead >= 1);
|
||||
assert(ahead >= 1);
|
||||
lazy_match_min_gain = ahead;
|
||||
|
||||
#if 0
|
||||
|
||||
if (l3)
|
||||
lit2 -= ahead;
|
||||
|
||||
#endif
|
||||
|
||||
if (lit1 <= 3)
|
||||
@@ -391,6 +424,7 @@ min_gain(lzo_uint ahead, lzo_uint lit1, lzo_uint lit2, lzo_uint l1, lzo_uint l2,
|
||||
lazy_match_min_gain += (lit2 <= 18) ? 0 : 1;
|
||||
|
||||
lazy_match_min_gain += (l2 - l1) * 2;
|
||||
|
||||
if (l3)
|
||||
lazy_match_min_gain -= (ahead - l3) * 2;
|
||||
|
||||
@@ -398,9 +432,11 @@ min_gain(lzo_uint ahead, lzo_uint lit1, lzo_uint lit2, lzo_uint l1, lzo_uint l2,
|
||||
lazy_match_min_gain = 0;
|
||||
|
||||
#if 0
|
||||
|
||||
if (l1 == 2)
|
||||
if (lazy_match_min_gain == 0)
|
||||
lazy_match_min_gain = 1;
|
||||
|
||||
#endif
|
||||
|
||||
return lazy_match_min_gain;
|
||||
@@ -413,13 +449,14 @@ min_gain(lzo_uint ahead, lzo_uint lit1, lzo_uint lit2, lzo_uint l1, lzo_uint l2,
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
static
|
||||
void assert_match( const lzo_swd_p swd, lzo_uint m_len, lzo_uint m_off )
|
||||
void assert_match(const lzo_swd_p swd, lzo_uint m_len, lzo_uint m_off)
|
||||
{
|
||||
const LZO_COMPRESS_T *c = swd->c;
|
||||
const LZO_COMPRESS_T* c = swd->c;
|
||||
lzo_uint d_off;
|
||||
|
||||
assert(m_len >= 2);
|
||||
if (m_off <= (lzo_uint) (c->bp - c->in))
|
||||
|
||||
if (m_off <= (lzo_uint)(c->bp - c->in))
|
||||
{
|
||||
assert(c->bp - m_off + m_len < c->ip);
|
||||
assert(lzo_memcmp(c->bp, c->bp - m_off, m_len) == 0);
|
||||
@@ -427,8 +464,9 @@ void assert_match( const lzo_swd_p swd, lzo_uint m_len, lzo_uint m_off )
|
||||
else
|
||||
{
|
||||
assert(swd->dict != NULL);
|
||||
d_off = m_off - (lzo_uint) (c->bp - c->in);
|
||||
d_off = m_off - (lzo_uint)(c->bp - c->in);
|
||||
assert(d_off <= swd->dict_len);
|
||||
|
||||
if (m_len > d_off)
|
||||
{
|
||||
assert(lzo_memcmp(c->bp, swd->dict_end - d_off, d_off) == 0);
|
||||
@@ -449,25 +487,30 @@ void assert_match( const lzo_swd_p swd, lzo_uint m_len, lzo_uint m_off )
|
||||
#if defined(SWD_BEST_OFF)
|
||||
|
||||
static void
|
||||
better_match ( const lzo_swd_p swd, lzo_uint *m_len, lzo_uint *m_off )
|
||||
better_match(const lzo_swd_p swd, lzo_uint* m_len, lzo_uint* m_off)
|
||||
{
|
||||
#if defined(LZO1Z)
|
||||
const LZO_COMPRESS_T *c = swd->c;
|
||||
const LZO_COMPRESS_T* c = swd->c;
|
||||
#endif
|
||||
|
||||
if (*m_len <= M2_MIN_LEN)
|
||||
return;
|
||||
|
||||
#if defined(LZO1Z)
|
||||
|
||||
if (*m_off == c->last_m_off && *m_len <= M2_MAX_LEN)
|
||||
return;
|
||||
|
||||
#if 1
|
||||
|
||||
if (*m_len >= M2_MIN_LEN + 1 && *m_len <= M2_MAX_LEN + 1 &&
|
||||
c->last_m_off && swd->best_off[*m_len-1] == c->last_m_off)
|
||||
c->last_m_off && swd->best_off[*m_len - 1] == c->last_m_off)
|
||||
{
|
||||
*m_len = *m_len - 1;
|
||||
*m_off = swd->best_off[*m_len];
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -475,38 +518,44 @@ better_match ( const lzo_swd_p swd, lzo_uint *m_len, lzo_uint *m_off )
|
||||
return;
|
||||
|
||||
#if 1
|
||||
|
||||
/* M3/M4 -> M2 */
|
||||
if (*m_off > M2_MAX_OFFSET &&
|
||||
*m_len >= M2_MIN_LEN + 1 && *m_len <= M2_MAX_LEN + 1 &&
|
||||
swd->best_off[*m_len-1] && swd->best_off[*m_len-1] <= M2_MAX_OFFSET)
|
||||
*m_len >= M2_MIN_LEN + 1 && *m_len <= M2_MAX_LEN + 1 &&
|
||||
swd->best_off[*m_len - 1] && swd->best_off[*m_len - 1] <= M2_MAX_OFFSET)
|
||||
{
|
||||
*m_len = *m_len - 1;
|
||||
*m_off = swd->best_off[*m_len];
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
|
||||
/* M4 -> M2 */
|
||||
if (*m_off > M3_MAX_OFFSET &&
|
||||
*m_len >= M4_MAX_LEN + 1 && *m_len <= M2_MAX_LEN + 2 &&
|
||||
swd->best_off[*m_len-2] && swd->best_off[*m_len-2] <= M2_MAX_OFFSET)
|
||||
*m_len >= M4_MAX_LEN + 1 && *m_len <= M2_MAX_LEN + 2 &&
|
||||
swd->best_off[*m_len - 2] && swd->best_off[*m_len - 2] <= M2_MAX_OFFSET)
|
||||
{
|
||||
*m_len = *m_len - 2;
|
||||
*m_off = swd->best_off[*m_len];
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
|
||||
/* M4 -> M3 */
|
||||
if (*m_off > M3_MAX_OFFSET &&
|
||||
*m_len >= M4_MAX_LEN + 1 && *m_len <= M3_MAX_LEN + 1 &&
|
||||
swd->best_off[*m_len-1] && swd->best_off[*m_len-1] <= M3_MAX_OFFSET)
|
||||
*m_len >= M4_MAX_LEN + 1 && *m_len <= M3_MAX_LEN + 1 &&
|
||||
swd->best_off[*m_len - 1] && swd->best_off[*m_len - 1] <= M3_MAX_OFFSET)
|
||||
{
|
||||
*m_len = *m_len - 1;
|
||||
*m_off = swd->best_off[*m_len];
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -518,24 +567,24 @@ better_match ( const lzo_swd_p swd, lzo_uint *m_len, lzo_uint *m_off )
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1x_999_compress_internal ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len,
|
||||
lzo_callback_p cb,
|
||||
int try_lazy_parm,
|
||||
lzo_uint good_length,
|
||||
lzo_uint max_lazy,
|
||||
lzo_uint nice_length,
|
||||
lzo_uint max_chain,
|
||||
lzo_uint32_t flags )
|
||||
lzo1x_999_compress_internal(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len,
|
||||
lzo_callback_p cb,
|
||||
int try_lazy_parm,
|
||||
lzo_uint good_length,
|
||||
lzo_uint max_lazy,
|
||||
lzo_uint nice_length,
|
||||
lzo_uint max_chain,
|
||||
lzo_uint32_t flags)
|
||||
{
|
||||
lzo_bytep op;
|
||||
const lzo_bytep ii;
|
||||
lzo_uint lit;
|
||||
lzo_uint m_len, m_off;
|
||||
LZO_COMPRESS_T cc;
|
||||
LZO_COMPRESS_T * const c = &cc;
|
||||
LZO_COMPRESS_T* const c = &cc;
|
||||
lzo_swd_p const swd = (lzo_swd_p) wrkmem;
|
||||
lzo_uint try_lazy;
|
||||
int r;
|
||||
@@ -551,20 +600,25 @@ lzo1x_999_compress_internal ( const lzo_bytep in , lzo_uint in_len,
|
||||
# error
|
||||
#endif
|
||||
|
||||
/* setup parameter defaults */
|
||||
/* setup parameter defaults */
|
||||
/* number of lazy match tries */
|
||||
try_lazy = (lzo_uint) try_lazy_parm;
|
||||
|
||||
if (try_lazy_parm < 0)
|
||||
try_lazy = 1;
|
||||
|
||||
/* reduce lazy match search if we already have a match with this length */
|
||||
if (good_length == 0)
|
||||
good_length = 32;
|
||||
|
||||
/* do not try a lazy match if we already have a match with this length */
|
||||
if (max_lazy == 0)
|
||||
max_lazy = 32;
|
||||
|
||||
/* stop searching for longer matches than this one */
|
||||
if (nice_length == 0)
|
||||
nice_length = 0;
|
||||
|
||||
/* don't search more positions than this */
|
||||
if (max_chain == 0)
|
||||
max_chain = SWD_MAX_CHAIN;
|
||||
@@ -582,17 +636,22 @@ lzo1x_999_compress_internal ( const lzo_bytep in , lzo_uint in_len,
|
||||
lit = 0;
|
||||
c->r1_lit = c->r1_m_len = 0;
|
||||
|
||||
r = init_match(c,swd,dict,dict_len,flags);
|
||||
r = init_match(c, swd, dict, dict_len, flags);
|
||||
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
if (max_chain > 0)
|
||||
swd->max_chain = max_chain;
|
||||
|
||||
if (nice_length > 0)
|
||||
swd->nice_length = nice_length;
|
||||
|
||||
r = find_match(c,swd,0,0);
|
||||
r = find_match(c, swd, 0, 0);
|
||||
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
while (c->look > 0)
|
||||
{
|
||||
lzo_uint ahead;
|
||||
@@ -606,21 +665,23 @@ lzo1x_999_compress_internal ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
assert(c->bp == c->ip - c->look);
|
||||
assert(c->bp >= in);
|
||||
|
||||
if (lit == 0)
|
||||
ii = c->bp;
|
||||
|
||||
assert(ii + lit == c->bp);
|
||||
assert(swd->b_char == *(c->bp));
|
||||
|
||||
if ( m_len < 2 ||
|
||||
(m_len == 2 && (m_off > M1_MAX_OFFSET || lit == 0 || lit >= 4)) ||
|
||||
if (m_len < 2 ||
|
||||
(m_len == 2 && (m_off > M1_MAX_OFFSET || lit == 0 || lit >= 4)) ||
|
||||
#if 1
|
||||
/* Do not accept this match for compressed-data compatibility
|
||||
* with LZO v1.01 and before
|
||||
* [ might be a problem for decompress() and optimize() ]
|
||||
*/
|
||||
(m_len == 2 && op == out) ||
|
||||
/* Do not accept this match for compressed-data compatibility
|
||||
* with LZO v1.01 and before
|
||||
* [ might be a problem for decompress() and optimize() ]
|
||||
*/
|
||||
(m_len == 2 && op == out) ||
|
||||
#endif
|
||||
(op == out && lit == 0))
|
||||
(op == out && lit == 0))
|
||||
{
|
||||
/* a literal */
|
||||
m_len = 0;
|
||||
@@ -634,24 +695,28 @@ lzo1x_999_compress_internal ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
if (m_len == 0)
|
||||
{
|
||||
/* a literal */
|
||||
/* a literal */
|
||||
lit++;
|
||||
swd->max_chain = max_chain;
|
||||
r = find_match(c,swd,1,0);
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
r = find_match(c, swd, 1, 0);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* a match */
|
||||
/* a match */
|
||||
#if defined(SWD_BEST_OFF)
|
||||
|
||||
if (swd->use_best_off)
|
||||
better_match(swd,&m_len,&m_off);
|
||||
better_match(swd, &m_len, &m_off);
|
||||
|
||||
#endif
|
||||
assert_match(swd,m_len,m_off);
|
||||
assert_match(swd, m_len, m_off);
|
||||
|
||||
|
||||
/* shall we try a lazy match ? */
|
||||
ahead = 0;
|
||||
|
||||
if (try_lazy == 0 || m_len >= max_lazy)
|
||||
{
|
||||
/* no */
|
||||
@@ -661,7 +726,7 @@ lzo1x_999_compress_internal ( const lzo_bytep in , lzo_uint in_len,
|
||||
else
|
||||
{
|
||||
/* yes, try a lazy match */
|
||||
l1 = len_of_coded_match(m_len,m_off,lit);
|
||||
l1 = len_of_coded_match(m_len, m_off, lit);
|
||||
assert(l1 > 0);
|
||||
#if 1
|
||||
max_ahead = LZO_MIN(try_lazy, l1 - 1);
|
||||
@@ -679,63 +744,79 @@ lzo1x_999_compress_internal ( const lzo_bytep in , lzo_uint in_len,
|
||||
swd->max_chain = max_chain >> 2;
|
||||
else
|
||||
swd->max_chain = max_chain;
|
||||
r = find_match(c,swd,1,0);
|
||||
|
||||
r = find_match(c, swd, 1, 0);
|
||||
ahead++;
|
||||
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
assert(c->look > 0);
|
||||
assert(ii + lit + ahead == c->bp);
|
||||
|
||||
#if defined(LZO1Z)
|
||||
|
||||
if (m_off == c->last_m_off && c->m_off != c->last_m_off)
|
||||
if (m_len >= M2_MIN_LEN && m_len <= M2_MAX_LEN)
|
||||
c->m_len = 0;
|
||||
|
||||
#endif
|
||||
|
||||
if (c->m_len < m_len)
|
||||
continue;
|
||||
|
||||
#if 1
|
||||
|
||||
if (c->m_len == m_len && c->m_off >= m_off)
|
||||
continue;
|
||||
|
||||
#endif
|
||||
#if defined(SWD_BEST_OFF)
|
||||
|
||||
if (swd->use_best_off)
|
||||
better_match(swd,&c->m_len,&c->m_off);
|
||||
better_match(swd, &c->m_len, &c->m_off);
|
||||
|
||||
#endif
|
||||
l2 = len_of_coded_match(c->m_len,c->m_off,lit+ahead);
|
||||
l2 = len_of_coded_match(c->m_len, c->m_off, lit + ahead);
|
||||
|
||||
if (l2 == 0)
|
||||
continue;
|
||||
|
||||
#if 0
|
||||
|
||||
if (c->m_len == m_len && l2 >= l1)
|
||||
continue;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if 1
|
||||
/* compressed-data compatibility [see above] */
|
||||
l3 = (op == out) ? 0 : len_of_coded_match(ahead,m_off,lit);
|
||||
l3 = (op == out) ? 0 : len_of_coded_match(ahead, m_off, lit);
|
||||
#else
|
||||
l3 = len_of_coded_match(ahead,m_off,lit);
|
||||
l3 = len_of_coded_match(ahead, m_off, lit);
|
||||
#endif
|
||||
|
||||
lazy_match_min_gain = min_gain(ahead,lit,lit+ahead,l1,l2,l3);
|
||||
lazy_match_min_gain = min_gain(ahead, lit, lit + ahead, l1, l2, l3);
|
||||
|
||||
if (c->m_len >= m_len + lazy_match_min_gain)
|
||||
{
|
||||
c->lazy++;
|
||||
assert_match(swd,c->m_len,c->m_off);
|
||||
assert_match(swd, c->m_len, c->m_off);
|
||||
|
||||
if (l3)
|
||||
{
|
||||
/* code previous run */
|
||||
op = code_run(c,op,ii,lit,ahead);
|
||||
op = code_run(c, op, ii, lit, ahead);
|
||||
lit = 0;
|
||||
/* code shortened match */
|
||||
op = code_match(c,op,ahead,m_off);
|
||||
op = code_match(c, op, ahead, m_off);
|
||||
}
|
||||
else
|
||||
{
|
||||
lit += ahead;
|
||||
assert(ii + lit == c->bp);
|
||||
}
|
||||
|
||||
goto lazy_match_done;
|
||||
}
|
||||
}
|
||||
@@ -744,22 +825,24 @@ lzo1x_999_compress_internal ( const lzo_bytep in , lzo_uint in_len,
|
||||
assert(ii + lit + ahead == c->bp);
|
||||
|
||||
/* 1 - code run */
|
||||
op = code_run(c,op,ii,lit,m_len);
|
||||
op = code_run(c, op, ii, lit, m_len);
|
||||
lit = 0;
|
||||
|
||||
/* 2 - code match */
|
||||
op = code_match(c,op,m_len,m_off);
|
||||
op = code_match(c, op, m_len, m_off);
|
||||
swd->max_chain = max_chain;
|
||||
r = find_match(c,swd,m_len,1+ahead);
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
r = find_match(c, swd, m_len, 1 + ahead);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
|
||||
lazy_match_done: ;
|
||||
lazy_match_done:
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
/* store final run */
|
||||
if (lit > 0)
|
||||
op = STORE_RUN(c,op,ii,lit);
|
||||
op = STORE_RUN(c, op, ii, lit);
|
||||
|
||||
#if defined(LZO_EOF_CODE)
|
||||
*op++ = M4_MARKER | 1;
|
||||
@@ -777,9 +860,9 @@ lazy_match_done: ;
|
||||
|
||||
#if 0
|
||||
printf("%ld %ld -> %ld %ld: %ld %ld %ld %ld %ld %ld: %ld %ld %ld %ld\n",
|
||||
(long) c->textsize, (long) in_len, (long) c->codesize,
|
||||
c->match_bytes, c->m1a_m, c->m1b_m, c->m2_m, c->m3_m, c->m4_m,
|
||||
c->lit_bytes, c->lit1_r, c->lit2_r, c->lit3_r, c->lazy);
|
||||
(long) c->textsize, (long) in_len, (long) c->codesize,
|
||||
c->match_bytes, c->m1a_m, c->m1b_m, c->m2_m, c->m3_m, c->m4_m,
|
||||
c->lit_bytes, c->lit1_r, c->lit2_r, c->lit3_r, c->lazy);
|
||||
#endif
|
||||
assert(c->lit_bytes + c->match_bytes == in_len);
|
||||
|
||||
@@ -792,12 +875,12 @@ lazy_match_done: ;
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1x_999_compress_level ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len,
|
||||
lzo_callback_p cb,
|
||||
int compression_level )
|
||||
lzo1x_999_compress_level(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len,
|
||||
lzo_callback_p cb,
|
||||
int compression_level)
|
||||
{
|
||||
static const struct
|
||||
{
|
||||
@@ -807,7 +890,8 @@ lzo1x_999_compress_level ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_uint nice_length;
|
||||
lzo_uint max_chain;
|
||||
lzo_uint32_t flags;
|
||||
} c[9] = {
|
||||
} c[9] =
|
||||
{
|
||||
/* faster compression */
|
||||
{ 0, 0, 0, 8, 4, 0 },
|
||||
{ 0, 0, 0, 16, 8, 0 },
|
||||
@@ -845,19 +929,19 @@ lzo1x_999_compress_level ( const lzo_bytep in , lzo_uint in_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1x_999_compress_dict ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len )
|
||||
lzo1x_999_compress_dict(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len)
|
||||
{
|
||||
return lzo1x_999_compress_level(in, in_len, out, out_len, wrkmem,
|
||||
dict, dict_len, 0, 8);
|
||||
}
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1x_999_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
lzo1x_999_compress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return lzo1x_999_compress_level(in, in_len, out, out_len, wrkmem,
|
||||
NULL, 0, (lzo_callback_p) 0, 8);
|
||||
|
||||
395
extern/lzo/src/lzo1x_c.ch
vendored
395
extern/lzo/src/lzo1x_c.ch
vendored
@@ -28,7 +28,7 @@
|
||||
|
||||
|
||||
#if 1 && defined(DO_COMPRESS) && !defined(do_compress)
|
||||
/* choose a unique name to better help PGO optimizations */
|
||||
/* choose a unique name to better help PGO optimizations */
|
||||
# define do_compress LZO_PP_ECONCAT2(DO_COMPRESS,_core)
|
||||
#endif
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
************************************************************************/
|
||||
|
||||
static __lzo_noinline lzo_uint
|
||||
do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_uint ti, lzo_voidp wrkmem)
|
||||
do_compress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_uint ti, lzo_voidp wrkmem)
|
||||
{
|
||||
const lzo_bytep ip;
|
||||
lzo_bytep op;
|
||||
@@ -54,6 +54,7 @@ do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
ii = ip;
|
||||
|
||||
ip += ti < 4 ? 4 - ti : 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
const lzo_bytep m_pos;
|
||||
@@ -62,26 +63,36 @@ do_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_uint m_len;
|
||||
lzo_uint dindex;
|
||||
next:
|
||||
|
||||
if __lzo_unlikely(ip >= ip_end)
|
||||
break;
|
||||
DINDEX1(dindex,ip);
|
||||
GINDEX(m_pos,m_off,dict,dindex,in);
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET))
|
||||
|
||||
DINDEX1(dindex, ip);
|
||||
GINDEX(m_pos, m_off, dict, dindex, in);
|
||||
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos, m_off, in, ip, M4_MAX_OFFSET))
|
||||
goto literal;
|
||||
|
||||
#if 1
|
||||
|
||||
if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
|
||||
goto try_match;
|
||||
DINDEX2(dindex,ip);
|
||||
|
||||
DINDEX2(dindex, ip);
|
||||
#endif
|
||||
GINDEX(m_pos,m_off,dict,dindex,in);
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET))
|
||||
GINDEX(m_pos, m_off, dict, dindex, in);
|
||||
|
||||
if (LZO_CHECK_MPOS_NON_DET(m_pos, m_off, in, ip, M4_MAX_OFFSET))
|
||||
goto literal;
|
||||
|
||||
if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
|
||||
goto try_match;
|
||||
|
||||
goto literal;
|
||||
|
||||
try_match:
|
||||
#if (LZO_OPT_UNALIGNED32)
|
||||
|
||||
if (UA_GET_NE32(m_pos) != UA_GET_NE32(ip))
|
||||
#else
|
||||
if (m_pos[0] != ip[0] || m_pos[1] != ip[1] || m_pos[2] != ip[2] || m_pos[3] != ip[3])
|
||||
@@ -89,187 +100,264 @@ try_match:
|
||||
{
|
||||
/* a literal */
|
||||
literal:
|
||||
UPDATE_I(dict,0,dindex,ip,in);
|
||||
UPDATE_I(dict, 0, dindex, ip, in);
|
||||
ip += 1 + ((ip - ii) >> 5);
|
||||
continue;
|
||||
}
|
||||
/*match:*/
|
||||
UPDATE_I(dict,0,dindex,ip,in);
|
||||
|
||||
/*match:*/
|
||||
UPDATE_I(dict, 0, dindex, ip, in);
|
||||
#else
|
||||
lzo_uint m_off;
|
||||
lzo_uint m_len;
|
||||
{
|
||||
lzo_uint32_t dv;
|
||||
lzo_uint dindex;
|
||||
lzo_uint32_t dv;
|
||||
lzo_uint dindex;
|
||||
literal:
|
||||
ip += 1 + ((ip - ii) >> 5);
|
||||
ip += 1 + ((ip - ii) >> 5);
|
||||
next:
|
||||
if __lzo_unlikely(ip >= ip_end)
|
||||
break;
|
||||
dv = UA_GET_LE32(ip);
|
||||
dindex = DINDEX(dv,ip);
|
||||
GINDEX(m_off,m_pos,in+dict,dindex,in);
|
||||
UPDATE_I(dict,0,dindex,ip,in);
|
||||
if __lzo_unlikely(dv != UA_GET_LE32(m_pos))
|
||||
goto literal;
|
||||
|
||||
if __lzo_unlikely(ip >= ip_end)
|
||||
break;
|
||||
|
||||
dv = UA_GET_LE32(ip);
|
||||
dindex = DINDEX(dv, ip);
|
||||
GINDEX(m_off, m_pos, in + dict, dindex, in);
|
||||
UPDATE_I(dict, 0, dindex, ip, in);
|
||||
|
||||
if __lzo_unlikely(dv != UA_GET_LE32(m_pos))
|
||||
goto literal;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* a match */
|
||||
/* a match */
|
||||
|
||||
ii -= ti; ti = 0;
|
||||
ii -= ti;
|
||||
ti = 0;
|
||||
{
|
||||
lzo_uint t = pd(ip,ii);
|
||||
if (t != 0)
|
||||
{
|
||||
if (t <= 3)
|
||||
lzo_uint t = pd(ip, ii);
|
||||
|
||||
if (t != 0)
|
||||
{
|
||||
op[-2] = LZO_BYTE(op[-2] | t);
|
||||
if (t <= 3)
|
||||
{
|
||||
op[-2] = LZO_BYTE(op[-2] | t);
|
||||
#if (LZO_OPT_UNALIGNED32)
|
||||
UA_COPY4(op, ii);
|
||||
op += t;
|
||||
UA_COPY4(op, ii);
|
||||
op += t;
|
||||
#else
|
||||
{ do *op++ = *ii++; while (--t > 0); }
|
||||
{ do* op++ = *ii++; while (--t > 0); }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if (LZO_OPT_UNALIGNED32) || (LZO_OPT_UNALIGNED64)
|
||||
else if (t <= 16)
|
||||
{
|
||||
*op++ = LZO_BYTE(t - 3);
|
||||
UA_COPY8(op, ii);
|
||||
UA_COPY8(op+8, ii+8);
|
||||
op += t;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
if (t <= 18)
|
||||
else if (t <= 16)
|
||||
{
|
||||
*op++ = LZO_BYTE(t - 3);
|
||||
UA_COPY8(op, ii);
|
||||
UA_COPY8(op + 8, ii + 8);
|
||||
op += t;
|
||||
}
|
||||
|
||||
#endif
|
||||
else
|
||||
{
|
||||
lzo_uint tt = t - 18;
|
||||
*op++ = 0;
|
||||
while __lzo_unlikely(tt > 255)
|
||||
if (t <= 18)
|
||||
*op++ = LZO_BYTE(t - 3);
|
||||
else
|
||||
{
|
||||
tt -= 255;
|
||||
UA_SET1(op, 0);
|
||||
op++;
|
||||
lzo_uint tt = t - 18;
|
||||
*op++ = 0;
|
||||
|
||||
while __lzo_unlikely(tt > 255)
|
||||
{
|
||||
tt -= 255;
|
||||
UA_SET1(op, 0);
|
||||
op++;
|
||||
}
|
||||
|
||||
assert(tt > 0);
|
||||
*op++ = LZO_BYTE(tt);
|
||||
}
|
||||
assert(tt > 0);
|
||||
*op++ = LZO_BYTE(tt);
|
||||
}
|
||||
|
||||
#if (LZO_OPT_UNALIGNED32) || (LZO_OPT_UNALIGNED64)
|
||||
do {
|
||||
UA_COPY8(op, ii);
|
||||
UA_COPY8(op+8, ii+8);
|
||||
op += 16; ii += 16; t -= 16;
|
||||
} while (t >= 16); if (t > 0)
|
||||
|
||||
do
|
||||
{
|
||||
UA_COPY8(op, ii);
|
||||
UA_COPY8(op + 8, ii + 8);
|
||||
op += 16;
|
||||
ii += 16;
|
||||
t -= 16;
|
||||
}
|
||||
while (t >= 16);
|
||||
|
||||
if (t > 0)
|
||||
#endif
|
||||
{ do *op++ = *ii++; while (--t > 0); }
|
||||
{ do* op++ = *ii++; while (--t > 0); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_len = 4;
|
||||
{
|
||||
#if (LZO_OPT_UNALIGNED64)
|
||||
lzo_uint64_t v;
|
||||
v = UA_GET_NE64(ip + m_len) ^ UA_GET_NE64(m_pos + m_len);
|
||||
if __lzo_unlikely(v == 0) {
|
||||
do {
|
||||
m_len += 8;
|
||||
v = UA_GET_NE64(ip + m_len) ^ UA_GET_NE64(m_pos + m_len);
|
||||
if __lzo_unlikely(ip + m_len >= ip_end)
|
||||
goto m_len_done;
|
||||
} while (v == 0);
|
||||
}
|
||||
lzo_uint64_t v;
|
||||
v = UA_GET_NE64(ip + m_len) ^ UA_GET_NE64(m_pos + m_len);
|
||||
|
||||
if __lzo_unlikely(v == 0)
|
||||
{
|
||||
do
|
||||
{
|
||||
m_len += 8;
|
||||
v = UA_GET_NE64(ip + m_len) ^ UA_GET_NE64(m_pos + m_len);
|
||||
|
||||
if __lzo_unlikely(ip + m_len >= ip_end)
|
||||
goto m_len_done;
|
||||
}
|
||||
while (v == 0);
|
||||
}
|
||||
|
||||
#if (LZO_ABI_BIG_ENDIAN) && defined(lzo_bitops_ctlz64)
|
||||
m_len += lzo_bitops_ctlz64(v) / CHAR_BIT;
|
||||
m_len += lzo_bitops_ctlz64(v) / CHAR_BIT;
|
||||
#elif (LZO_ABI_BIG_ENDIAN)
|
||||
if ((v >> (64 - CHAR_BIT)) == 0) do {
|
||||
v <<= CHAR_BIT;
|
||||
m_len += 1;
|
||||
} while ((v >> (64 - CHAR_BIT)) == 0);
|
||||
|
||||
if ((v >> (64 - CHAR_BIT)) == 0) do
|
||||
{
|
||||
v <<= CHAR_BIT;
|
||||
m_len += 1;
|
||||
}
|
||||
while ((v >> (64 - CHAR_BIT)) == 0);
|
||||
|
||||
#elif (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_cttz64)
|
||||
m_len += lzo_bitops_cttz64(v) / CHAR_BIT;
|
||||
m_len += lzo_bitops_cttz64(v) / CHAR_BIT;
|
||||
#elif (LZO_ABI_LITTLE_ENDIAN)
|
||||
if ((v & UCHAR_MAX) == 0) do {
|
||||
v >>= CHAR_BIT;
|
||||
m_len += 1;
|
||||
} while ((v & UCHAR_MAX) == 0);
|
||||
|
||||
if ((v & UCHAR_MAX) == 0) do
|
||||
{
|
||||
v >>= CHAR_BIT;
|
||||
m_len += 1;
|
||||
}
|
||||
while ((v & UCHAR_MAX) == 0);
|
||||
|
||||
#else
|
||||
if (ip[m_len] == m_pos[m_len]) do {
|
||||
m_len += 1;
|
||||
} while (ip[m_len] == m_pos[m_len]);
|
||||
|
||||
if (ip[m_len] == m_pos[m_len]) do
|
||||
{
|
||||
m_len += 1;
|
||||
}
|
||||
while (ip[m_len] == m_pos[m_len]);
|
||||
|
||||
#endif
|
||||
#elif (LZO_OPT_UNALIGNED32)
|
||||
lzo_uint32_t v;
|
||||
v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len);
|
||||
if __lzo_unlikely(v == 0) {
|
||||
do {
|
||||
m_len += 4;
|
||||
v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len);
|
||||
if (v != 0)
|
||||
break;
|
||||
m_len += 4;
|
||||
v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len);
|
||||
if __lzo_unlikely(ip + m_len >= ip_end)
|
||||
goto m_len_done;
|
||||
} while (v == 0);
|
||||
}
|
||||
lzo_uint32_t v;
|
||||
v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len);
|
||||
|
||||
if __lzo_unlikely(v == 0)
|
||||
{
|
||||
do
|
||||
{
|
||||
m_len += 4;
|
||||
v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len);
|
||||
|
||||
if (v != 0)
|
||||
break;
|
||||
|
||||
m_len += 4;
|
||||
v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len);
|
||||
|
||||
if __lzo_unlikely(ip + m_len >= ip_end)
|
||||
goto m_len_done;
|
||||
}
|
||||
while (v == 0);
|
||||
}
|
||||
|
||||
#if (LZO_ABI_BIG_ENDIAN) && defined(lzo_bitops_ctlz32)
|
||||
m_len += lzo_bitops_ctlz32(v) / CHAR_BIT;
|
||||
m_len += lzo_bitops_ctlz32(v) / CHAR_BIT;
|
||||
#elif (LZO_ABI_BIG_ENDIAN)
|
||||
if ((v >> (32 - CHAR_BIT)) == 0) do {
|
||||
v <<= CHAR_BIT;
|
||||
m_len += 1;
|
||||
} while ((v >> (32 - CHAR_BIT)) == 0);
|
||||
|
||||
if ((v >> (32 - CHAR_BIT)) == 0) do
|
||||
{
|
||||
v <<= CHAR_BIT;
|
||||
m_len += 1;
|
||||
}
|
||||
while ((v >> (32 - CHAR_BIT)) == 0);
|
||||
|
||||
#elif (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_cttz32)
|
||||
m_len += lzo_bitops_cttz32(v) / CHAR_BIT;
|
||||
m_len += lzo_bitops_cttz32(v) / CHAR_BIT;
|
||||
#elif (LZO_ABI_LITTLE_ENDIAN)
|
||||
if ((v & UCHAR_MAX) == 0) do {
|
||||
v >>= CHAR_BIT;
|
||||
m_len += 1;
|
||||
} while ((v & UCHAR_MAX) == 0);
|
||||
|
||||
if ((v & UCHAR_MAX) == 0) do
|
||||
{
|
||||
v >>= CHAR_BIT;
|
||||
m_len += 1;
|
||||
}
|
||||
while ((v & UCHAR_MAX) == 0);
|
||||
|
||||
#else
|
||||
if (ip[m_len] == m_pos[m_len]) do {
|
||||
m_len += 1;
|
||||
} while (ip[m_len] == m_pos[m_len]);
|
||||
|
||||
if (ip[m_len] == m_pos[m_len]) do
|
||||
{
|
||||
m_len += 1;
|
||||
}
|
||||
while (ip[m_len] == m_pos[m_len]);
|
||||
|
||||
#endif
|
||||
#else
|
||||
if __lzo_unlikely(ip[m_len] == m_pos[m_len]) {
|
||||
do {
|
||||
m_len += 1;
|
||||
if (ip[m_len] != m_pos[m_len])
|
||||
break;
|
||||
m_len += 1;
|
||||
if (ip[m_len] != m_pos[m_len])
|
||||
break;
|
||||
m_len += 1;
|
||||
if (ip[m_len] != m_pos[m_len])
|
||||
break;
|
||||
m_len += 1;
|
||||
if (ip[m_len] != m_pos[m_len])
|
||||
break;
|
||||
m_len += 1;
|
||||
if (ip[m_len] != m_pos[m_len])
|
||||
break;
|
||||
m_len += 1;
|
||||
if (ip[m_len] != m_pos[m_len])
|
||||
break;
|
||||
m_len += 1;
|
||||
if (ip[m_len] != m_pos[m_len])
|
||||
break;
|
||||
m_len += 1;
|
||||
if __lzo_unlikely(ip + m_len >= ip_end)
|
||||
goto m_len_done;
|
||||
} while (ip[m_len] == m_pos[m_len]);
|
||||
}
|
||||
|
||||
if __lzo_unlikely(ip[m_len] == m_pos[m_len])
|
||||
{
|
||||
do
|
||||
{
|
||||
m_len += 1;
|
||||
|
||||
if (ip[m_len] != m_pos[m_len])
|
||||
break;
|
||||
|
||||
m_len += 1;
|
||||
|
||||
if (ip[m_len] != m_pos[m_len])
|
||||
break;
|
||||
|
||||
m_len += 1;
|
||||
|
||||
if (ip[m_len] != m_pos[m_len])
|
||||
break;
|
||||
|
||||
m_len += 1;
|
||||
|
||||
if (ip[m_len] != m_pos[m_len])
|
||||
break;
|
||||
|
||||
m_len += 1;
|
||||
|
||||
if (ip[m_len] != m_pos[m_len])
|
||||
break;
|
||||
|
||||
m_len += 1;
|
||||
|
||||
if (ip[m_len] != m_pos[m_len])
|
||||
break;
|
||||
|
||||
m_len += 1;
|
||||
|
||||
if (ip[m_len] != m_pos[m_len])
|
||||
break;
|
||||
|
||||
m_len += 1;
|
||||
|
||||
if __lzo_unlikely(ip + m_len >= ip_end)
|
||||
goto m_len_done;
|
||||
}
|
||||
while (ip[m_len] == m_pos[m_len]);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
m_len_done:
|
||||
m_off = pd(ip,m_pos);
|
||||
m_off = pd(ip, m_pos);
|
||||
ip += m_len;
|
||||
ii = ip;
|
||||
|
||||
if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET)
|
||||
{
|
||||
m_off -= 1;
|
||||
@@ -284,48 +372,57 @@ m_len_done:
|
||||
else if (m_off <= M3_MAX_OFFSET)
|
||||
{
|
||||
m_off -= 1;
|
||||
|
||||
if (m_len <= M3_MAX_LEN)
|
||||
*op++ = LZO_BYTE(M3_MARKER | (m_len - 2));
|
||||
else
|
||||
{
|
||||
m_len -= M3_MAX_LEN;
|
||||
*op++ = M3_MARKER | 0;
|
||||
|
||||
while __lzo_unlikely(m_len > 255)
|
||||
{
|
||||
m_len -= 255;
|
||||
UA_SET1(op, 0);
|
||||
op++;
|
||||
}
|
||||
|
||||
*op++ = LZO_BYTE(m_len);
|
||||
}
|
||||
|
||||
*op++ = LZO_BYTE(m_off << 2);
|
||||
*op++ = LZO_BYTE(m_off >> 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_off -= 0x4000;
|
||||
|
||||
if (m_len <= M4_MAX_LEN)
|
||||
*op++ = LZO_BYTE(M4_MARKER | ((m_off >> 11) & 8) | (m_len - 2));
|
||||
else
|
||||
{
|
||||
m_len -= M4_MAX_LEN;
|
||||
*op++ = LZO_BYTE(M4_MARKER | ((m_off >> 11) & 8));
|
||||
|
||||
while __lzo_unlikely(m_len > 255)
|
||||
{
|
||||
m_len -= 255;
|
||||
UA_SET1(op, 0);
|
||||
op++;
|
||||
}
|
||||
|
||||
*op++ = LZO_BYTE(m_len);
|
||||
}
|
||||
|
||||
*op++ = LZO_BYTE(m_off << 2);
|
||||
*op++ = LZO_BYTE(m_off >> 6);
|
||||
}
|
||||
|
||||
goto next;
|
||||
}
|
||||
|
||||
*out_len = pd(op, out);
|
||||
return pd(in_end,ii-ti);
|
||||
return pd(in_end, ii - ti);
|
||||
}
|
||||
|
||||
|
||||
@@ -334,9 +431,9 @@ m_len_done:
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
DO_COMPRESS(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
const lzo_bytep ip = in;
|
||||
lzo_bytep op = out;
|
||||
@@ -351,16 +448,19 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
ll = LZO_MIN(ll, 49152);
|
||||
#endif
|
||||
ll_end = (lzo_uintptr_t)ip + ll;
|
||||
|
||||
if ((ll_end + ((t + ll) >> 5)) <= ll_end || (const lzo_bytep)(ll_end + ((t + ll) >> 5)) <= ip + ll)
|
||||
break;
|
||||
|
||||
#if (LZO_DETERMINISTIC)
|
||||
lzo_memset(wrkmem, 0, ((lzo_uint)1 << D_BITS) * sizeof(lzo_dict_t));
|
||||
#endif
|
||||
t = do_compress(ip,ll,op,out_len,t,wrkmem);
|
||||
t = do_compress(ip, ll, op, out_len, t, wrkmem);
|
||||
ip += ll;
|
||||
op += *out_len;
|
||||
l -= ll;
|
||||
}
|
||||
|
||||
t += l;
|
||||
|
||||
if (t > 0)
|
||||
@@ -378,15 +478,18 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_uint tt = t - 18;
|
||||
|
||||
*op++ = 0;
|
||||
|
||||
while (tt > 255)
|
||||
{
|
||||
tt -= 255;
|
||||
UA_SET1(op, 0);
|
||||
op++;
|
||||
}
|
||||
|
||||
assert(tt > 0);
|
||||
*op++ = LZO_BYTE(tt);
|
||||
}
|
||||
|
||||
UA_COPYN(op, ii, t);
|
||||
op += t;
|
||||
}
|
||||
|
||||
227
extern/lzo/src/lzo1x_d.ch
vendored
227
extern/lzo/src/lzo1x_d.ch
vendored
@@ -35,9 +35,9 @@
|
||||
|
||||
#if defined(DO_DECOMPRESS)
|
||||
LZO_PUBLIC(int)
|
||||
DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
DO_DECOMPRESS(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
#endif
|
||||
{
|
||||
lzo_bytep op;
|
||||
@@ -61,6 +61,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
LZO_UNUSED(wrkmem);
|
||||
|
||||
#if defined(COPY_DICT)
|
||||
|
||||
if (dict)
|
||||
{
|
||||
if (dict_len > M4_MAX_OFFSET)
|
||||
@@ -68,6 +69,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
dict += dict_len - M4_MAX_OFFSET;
|
||||
dict_len = M4_MAX_OFFSET;
|
||||
}
|
||||
|
||||
dict_end = dict + dict_len;
|
||||
}
|
||||
else
|
||||
@@ -75,6 +77,7 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
dict_len = 0;
|
||||
dict_end = NULL;
|
||||
}
|
||||
|
||||
#endif /* COPY_DICT */
|
||||
|
||||
*out_len = 0;
|
||||
@@ -83,13 +86,22 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
ip = in;
|
||||
|
||||
NEED_IP(1);
|
||||
|
||||
if (*ip > 17)
|
||||
{
|
||||
t = *ip++ - 17;
|
||||
|
||||
if (t < 4)
|
||||
goto match_next;
|
||||
assert(t > 0); NEED_OP(t); NEED_IP(t+3);
|
||||
do *op++ = *ip++; while (--t > 0);
|
||||
|
||||
assert(t > 0);
|
||||
NEED_OP(t);
|
||||
NEED_IP(t + 3);
|
||||
|
||||
do* op++ = *ip++;
|
||||
|
||||
while (--t > 0);
|
||||
|
||||
goto first_literal_run;
|
||||
}
|
||||
|
||||
@@ -97,8 +109,10 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
{
|
||||
NEED_IP(3);
|
||||
t = *ip++;
|
||||
|
||||
if (t >= 16)
|
||||
goto match;
|
||||
|
||||
/* a literal run */
|
||||
if (t == 0)
|
||||
{
|
||||
@@ -109,47 +123,74 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
TEST_IV(t);
|
||||
NEED_IP(1);
|
||||
}
|
||||
|
||||
t += 15 + *ip++;
|
||||
}
|
||||
|
||||
/* copy literals */
|
||||
assert(t > 0); NEED_OP(t+3); NEED_IP(t+6);
|
||||
assert(t > 0);
|
||||
NEED_OP(t + 3);
|
||||
NEED_IP(t + 6);
|
||||
#if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32)
|
||||
t += 3;
|
||||
|
||||
if (t >= 8) do
|
||||
{
|
||||
UA_COPY8(op,ip);
|
||||
op += 8; ip += 8; t -= 8;
|
||||
} while (t >= 8);
|
||||
{
|
||||
UA_COPY8(op, ip);
|
||||
op += 8;
|
||||
ip += 8;
|
||||
t -= 8;
|
||||
}
|
||||
while (t >= 8);
|
||||
|
||||
if (t >= 4)
|
||||
{
|
||||
UA_COPY4(op,ip);
|
||||
op += 4; ip += 4; t -= 4;
|
||||
UA_COPY4(op, ip);
|
||||
op += 4;
|
||||
ip += 4;
|
||||
t -= 4;
|
||||
}
|
||||
|
||||
if (t > 0)
|
||||
{
|
||||
*op++ = *ip++;
|
||||
|
||||
if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } }
|
||||
}
|
||||
|
||||
#elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4)
|
||||
#if !(LZO_OPT_UNALIGNED32)
|
||||
if (PTR_ALIGNED2_4(op,ip))
|
||||
|
||||
if (PTR_ALIGNED2_4(op, ip))
|
||||
{
|
||||
#endif
|
||||
UA_COPY4(op,ip);
|
||||
op += 4; ip += 4;
|
||||
if (--t > 0)
|
||||
{
|
||||
if (t >= 4)
|
||||
UA_COPY4(op, ip);
|
||||
op += 4;
|
||||
ip += 4;
|
||||
|
||||
if (--t > 0)
|
||||
{
|
||||
do {
|
||||
UA_COPY4(op,ip);
|
||||
op += 4; ip += 4; t -= 4;
|
||||
} while (t >= 4);
|
||||
if (t > 0) do *op++ = *ip++; while (--t > 0);
|
||||
if (t >= 4)
|
||||
{
|
||||
do
|
||||
{
|
||||
UA_COPY4(op, ip);
|
||||
op += 4;
|
||||
ip += 4;
|
||||
t -= 4;
|
||||
}
|
||||
while (t >= 4);
|
||||
|
||||
if (t > 0) do* op++ = *ip++;
|
||||
|
||||
while (--t > 0);
|
||||
}
|
||||
else
|
||||
do* op++ = *ip++;
|
||||
|
||||
while (--t > 0);
|
||||
}
|
||||
else
|
||||
do *op++ = *ip++; while (--t > 0);
|
||||
}
|
||||
|
||||
#if !(LZO_OPT_UNALIGNED32)
|
||||
}
|
||||
else
|
||||
@@ -157,9 +198,15 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
#endif
|
||||
#if !(LZO_OPT_UNALIGNED32)
|
||||
{
|
||||
*op++ = *ip++; *op++ = *ip++; *op++ = *ip++;
|
||||
do *op++ = *ip++; while (--t > 0);
|
||||
*op++ = *ip++;
|
||||
*op++ = *ip++;
|
||||
*op++ = *ip++;
|
||||
|
||||
do* op++ = *ip++;
|
||||
|
||||
while (--t > 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -167,8 +214,10 @@ first_literal_run:
|
||||
|
||||
|
||||
t = *ip++;
|
||||
|
||||
if (t >= 16)
|
||||
goto match;
|
||||
|
||||
#if defined(COPY_DICT)
|
||||
#if defined(LZO1Z)
|
||||
m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
|
||||
@@ -177,7 +226,8 @@ first_literal_run:
|
||||
m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2);
|
||||
#endif
|
||||
NEED_OP(3);
|
||||
t = 3; COPY_DICT(t,m_off)
|
||||
t = 3;
|
||||
COPY_DICT(t, m_off)
|
||||
#else /* !COPY_DICT */
|
||||
#if defined(LZO1Z)
|
||||
t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
|
||||
@@ -188,15 +238,20 @@ first_literal_run:
|
||||
m_pos -= t >> 2;
|
||||
m_pos -= *ip++ << 2;
|
||||
#endif
|
||||
TEST_LB(m_pos); NEED_OP(3);
|
||||
*op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos;
|
||||
TEST_LB(m_pos);
|
||||
NEED_OP(3);
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos;
|
||||
#endif /* COPY_DICT */
|
||||
goto match_done;
|
||||
|
||||
|
||||
/* handle matches */
|
||||
for (;;) {
|
||||
for (;;)
|
||||
{
|
||||
match:
|
||||
|
||||
if (t >= 64) /* a M2 match */
|
||||
{
|
||||
#if defined(COPY_DICT)
|
||||
@@ -208,6 +263,7 @@ match:
|
||||
t = (t >> 4) - 3;
|
||||
#elif defined(LZO1Z)
|
||||
m_off = t & 0x1f;
|
||||
|
||||
if (m_off >= 0x1c)
|
||||
m_off = last_m_off;
|
||||
else
|
||||
@@ -215,6 +271,7 @@ match:
|
||||
m_off = 1 + (m_off << 6) + (*ip++ >> 2);
|
||||
last_m_off = m_off;
|
||||
}
|
||||
|
||||
t = (t >> 5) - 1;
|
||||
#endif
|
||||
#else /* !COPY_DICT */
|
||||
@@ -232,6 +289,7 @@ match:
|
||||
{
|
||||
lzo_uint off = t & 0x1f;
|
||||
m_pos = op;
|
||||
|
||||
if (off >= 0x1c)
|
||||
{
|
||||
assert(last_m_off > 0);
|
||||
@@ -246,13 +304,16 @@ match:
|
||||
}
|
||||
t = (t >> 5) - 1;
|
||||
#endif
|
||||
TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
|
||||
TEST_LB(m_pos);
|
||||
assert(t > 0);
|
||||
NEED_OP(t + 3 - 1);
|
||||
goto copy_match;
|
||||
#endif /* COPY_DICT */
|
||||
}
|
||||
else if (t >= 32) /* a M3 match */
|
||||
{
|
||||
t &= 31;
|
||||
|
||||
if (t == 0)
|
||||
{
|
||||
while (*ip == 0)
|
||||
@@ -262,9 +323,11 @@ match:
|
||||
TEST_OV(t);
|
||||
NEED_IP(1);
|
||||
}
|
||||
|
||||
t += 31 + *ip++;
|
||||
NEED_IP(2);
|
||||
}
|
||||
|
||||
#if defined(COPY_DICT)
|
||||
#if defined(LZO1Z)
|
||||
m_off = 1 + (ip[0] << 6) + (ip[1] >> 2);
|
||||
@@ -298,6 +361,7 @@ match:
|
||||
m_pos -= (t & 8) << 11;
|
||||
#endif /* COPY_DICT */
|
||||
t &= 7;
|
||||
|
||||
if (t == 0)
|
||||
{
|
||||
while (*ip == 0)
|
||||
@@ -307,9 +371,11 @@ match:
|
||||
TEST_OV(t);
|
||||
NEED_IP(1);
|
||||
}
|
||||
|
||||
t += 7 + *ip++;
|
||||
NEED_IP(2);
|
||||
}
|
||||
|
||||
#if defined(COPY_DICT)
|
||||
#if defined(LZO1Z)
|
||||
m_off += (ip[0] << 6) + (ip[1] >> 2);
|
||||
@@ -317,8 +383,10 @@ match:
|
||||
m_off += (ip[0] >> 2) + (ip[1] << 6);
|
||||
#endif
|
||||
ip += 2;
|
||||
|
||||
if (m_off == 0)
|
||||
goto eof_found;
|
||||
|
||||
m_off += 0x4000;
|
||||
#if defined(LZO1Z)
|
||||
last_m_off = m_off;
|
||||
@@ -332,8 +400,10 @@ match:
|
||||
m_pos -= (ip[0] >> 2) + (ip[1] << 6);
|
||||
#endif
|
||||
ip += 2;
|
||||
|
||||
if (m_pos == op)
|
||||
goto eof_found;
|
||||
|
||||
m_pos -= 0x4000;
|
||||
#if defined(LZO1Z)
|
||||
last_m_off = pd((const lzo_bytep)op, m_pos);
|
||||
@@ -350,7 +420,8 @@ match:
|
||||
m_off = 1 + (t >> 2) + (*ip++ << 2);
|
||||
#endif
|
||||
NEED_OP(2);
|
||||
t = 2; COPY_DICT(t,m_off)
|
||||
t = 2;
|
||||
COPY_DICT(t, m_off)
|
||||
#else /* !COPY_DICT */
|
||||
#if defined(LZO1Z)
|
||||
t = 1 + (t << 6) + (*ip++ >> 2);
|
||||
@@ -361,8 +432,10 @@ match:
|
||||
m_pos -= t >> 2;
|
||||
m_pos -= *ip++ << 2;
|
||||
#endif
|
||||
TEST_LB(m_pos); NEED_OP(2);
|
||||
*op++ = *m_pos++; *op++ = *m_pos;
|
||||
TEST_LB(m_pos);
|
||||
NEED_OP(2);
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos;
|
||||
#endif /* COPY_DICT */
|
||||
goto match_done;
|
||||
}
|
||||
@@ -370,56 +443,84 @@ match:
|
||||
/* copy match */
|
||||
#if defined(COPY_DICT)
|
||||
|
||||
NEED_OP(t+3-1);
|
||||
t += 3-1; COPY_DICT(t,m_off)
|
||||
NEED_OP(t + 3 - 1);
|
||||
t += 3 - 1;
|
||||
COPY_DICT(t, m_off)
|
||||
|
||||
#else /* !COPY_DICT */
|
||||
|
||||
TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
|
||||
TEST_LB(m_pos);
|
||||
assert(t > 0);
|
||||
NEED_OP(t + 3 - 1);
|
||||
#if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32)
|
||||
|
||||
if (op - m_pos >= 8)
|
||||
{
|
||||
t += (3 - 1);
|
||||
|
||||
if (t >= 8) do
|
||||
{
|
||||
UA_COPY8(op,m_pos);
|
||||
op += 8; m_pos += 8; t -= 8;
|
||||
} while (t >= 8);
|
||||
{
|
||||
UA_COPY8(op, m_pos);
|
||||
op += 8;
|
||||
m_pos += 8;
|
||||
t -= 8;
|
||||
}
|
||||
while (t >= 8);
|
||||
|
||||
if (t >= 4)
|
||||
{
|
||||
UA_COPY4(op,m_pos);
|
||||
op += 4; m_pos += 4; t -= 4;
|
||||
UA_COPY4(op, m_pos);
|
||||
op += 4;
|
||||
m_pos += 4;
|
||||
t -= 4;
|
||||
}
|
||||
|
||||
if (t > 0)
|
||||
{
|
||||
*op++ = m_pos[0];
|
||||
|
||||
if (t > 1) { *op++ = m_pos[1]; if (t > 2) { *op++ = m_pos[2]; } }
|
||||
}
|
||||
}
|
||||
else
|
||||
#elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4)
|
||||
#if !(LZO_OPT_UNALIGNED32)
|
||||
if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos))
|
||||
if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op, m_pos))
|
||||
{
|
||||
assert((op - m_pos) >= 4); /* both pointers are aligned */
|
||||
#else
|
||||
|
||||
if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4)
|
||||
{
|
||||
#endif
|
||||
UA_COPY4(op,m_pos);
|
||||
op += 4; m_pos += 4; t -= 4 - (3 - 1);
|
||||
do {
|
||||
UA_COPY4(op,m_pos);
|
||||
op += 4; m_pos += 4; t -= 4;
|
||||
} while (t >= 4);
|
||||
if (t > 0) do *op++ = *m_pos++; while (--t > 0);
|
||||
UA_COPY4(op, m_pos);
|
||||
op += 4;
|
||||
m_pos += 4;
|
||||
t -= 4 - (3 - 1);
|
||||
|
||||
do
|
||||
{
|
||||
UA_COPY4(op, m_pos);
|
||||
op += 4;
|
||||
m_pos += 4;
|
||||
t -= 4;
|
||||
}
|
||||
while (t >= 4);
|
||||
|
||||
if (t > 0) do* op++ = *m_pos++;
|
||||
|
||||
while (--t > 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
copy_match:
|
||||
*op++ = *m_pos++; *op++ = *m_pos++;
|
||||
do *op++ = *m_pos++; while (--t > 0);
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
|
||||
do* op++ = *m_pos++;
|
||||
|
||||
while (--t > 0);
|
||||
}
|
||||
|
||||
#endif /* COPY_DICT */
|
||||
@@ -430,17 +531,27 @@ match_done:
|
||||
#else
|
||||
t = ip[-2] & 3;
|
||||
#endif
|
||||
|
||||
if (t == 0)
|
||||
break;
|
||||
|
||||
/* copy literals */
|
||||
match_next:
|
||||
assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+3);
|
||||
assert(t > 0);
|
||||
assert(t < 4);
|
||||
NEED_OP(t);
|
||||
NEED_IP(t + 3);
|
||||
#if 0
|
||||
do *op++ = *ip++; while (--t > 0);
|
||||
|
||||
do* op++ = *ip++;
|
||||
|
||||
while (--t > 0);
|
||||
|
||||
#else
|
||||
*op++ = *ip++;
|
||||
|
||||
if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } }
|
||||
|
||||
#endif
|
||||
t = *ip++;
|
||||
}
|
||||
@@ -449,7 +560,7 @@ match_next:
|
||||
eof_found:
|
||||
*out_len = pd(op, out);
|
||||
return (ip == ip_end ? LZO_E_OK :
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
|
||||
|
||||
#if defined(HAVE_NEED_IP)
|
||||
|
||||
24
extern/lzo/src/lzo1x_d2.c
vendored
24
extern/lzo/src/lzo1x_d2.c
vendored
@@ -35,24 +35,24 @@
|
||||
|
||||
#if defined(LZO_ARCH_I386) && defined(LZO_USE_ASM)
|
||||
LZO_EXTERN(int) lzo1x_decompress_asm_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_PUBLIC(int) lzo1x_decompress_asm_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem)
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return lzo1x_decompress_safe(src, src_len, dst, dst_len, wrkmem);
|
||||
}
|
||||
LZO_EXTERN(int) lzo1x_decompress_asm_fast_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_PUBLIC(int) lzo1x_decompress_asm_fast_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem)
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return lzo1x_decompress_safe(src, src_len, dst, dst_len, wrkmem);
|
||||
}
|
||||
|
||||
8
extern/lzo/src/lzo1x_d3.c
vendored
8
extern/lzo/src/lzo1x_d3.c
vendored
@@ -81,10 +81,10 @@
|
||||
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo1x_decompress_dict_safe ( const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem /* NOT USED */,
|
||||
const lzo_bytep dict, lzo_uint dict_len)
|
||||
lzo1x_decompress_dict_safe(const lzo_bytep in, lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem /* NOT USED */,
|
||||
const lzo_bytep dict, lzo_uint dict_len)
|
||||
|
||||
|
||||
#include "lzo1x_d.ch"
|
||||
|
||||
126
extern/lzo/src/lzo1x_oo.ch
vendored
126
extern/lzo/src/lzo1x_oo.ch
vendored
@@ -41,6 +41,7 @@ static void copy2(lzo_bytep ip, const lzo_bytep m_pos, lzo_uint off)
|
||||
{
|
||||
assert(off > 0);
|
||||
ip[0] = m_pos[0];
|
||||
|
||||
if (off == 1)
|
||||
ip[1] = m_pos[0];
|
||||
else
|
||||
@@ -52,6 +53,7 @@ static void copy3(lzo_bytep ip, const lzo_bytep m_pos, lzo_uint off)
|
||||
{
|
||||
assert(off > 0);
|
||||
ip[0] = m_pos[0];
|
||||
|
||||
if (off == 1)
|
||||
{
|
||||
ip[2] = ip[1] = m_pos[0];
|
||||
@@ -74,9 +76,9 @@ static void copy3(lzo_bytep ip, const lzo_bytep m_pos, lzo_uint off)
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
DO_OPTIMIZE ( lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
DO_OPTIMIZE(lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
lzo_bytep op;
|
||||
lzo_bytep ip;
|
||||
@@ -98,41 +100,57 @@ DO_OPTIMIZE ( lzo_bytep in , lzo_uint in_len,
|
||||
ip = in;
|
||||
|
||||
assert(in_len >= 3);
|
||||
|
||||
if (*ip > 17)
|
||||
{
|
||||
t = *ip++ - 17;
|
||||
|
||||
if (t < 4)
|
||||
goto match_next;
|
||||
|
||||
goto first_literal_run;
|
||||
}
|
||||
|
||||
assert(*ip < 16 || (*ip == 17 && in_len == 3));
|
||||
|
||||
while (TEST_IP_AND_TEST_OP)
|
||||
{
|
||||
t = *ip++;
|
||||
|
||||
if (t >= 16)
|
||||
goto match;
|
||||
|
||||
/* a literal run */
|
||||
litp = ip - 1;
|
||||
|
||||
if (t == 0)
|
||||
{
|
||||
t = 15;
|
||||
|
||||
while (*ip == 0)
|
||||
t += 255, ip++;
|
||||
|
||||
t += *ip++;
|
||||
}
|
||||
|
||||
lit = t + 3;
|
||||
/* copy literals */
|
||||
copy_literal_run:
|
||||
*op++ = *ip++; *op++ = *ip++; *op++ = *ip++;
|
||||
*op++ = *ip++;
|
||||
*op++ = *ip++;
|
||||
*op++ = *ip++;
|
||||
first_literal_run:
|
||||
do *op++ = *ip++; while (--t > 0);
|
||||
|
||||
do* op++ = *ip++;
|
||||
|
||||
while (--t > 0);
|
||||
|
||||
|
||||
t = *ip++;
|
||||
|
||||
if (t >= 16)
|
||||
goto match;
|
||||
|
||||
#if defined(LZO1X)
|
||||
m_pos = op - 1 - 0x800;
|
||||
#elif defined(LZO1Y)
|
||||
@@ -140,13 +158,16 @@ first_literal_run:
|
||||
#endif
|
||||
m_pos -= t >> 2;
|
||||
m_pos -= *ip++ << 2;
|
||||
*op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
lit = 0;
|
||||
goto match_done;
|
||||
|
||||
|
||||
/* handle matches */
|
||||
do {
|
||||
do
|
||||
{
|
||||
if (t < 16) /* a M1 match */
|
||||
{
|
||||
m_pos = op - 1;
|
||||
@@ -161,6 +182,7 @@ first_literal_run:
|
||||
assert(litp == ip - 2 - lit - 2);
|
||||
assert((lzo_uint)(*litp & 3) == lit);
|
||||
nl = ip[-2] & 3;
|
||||
|
||||
/* test if a match follows */
|
||||
if (nl == 0 && lit == 1 && ip[0] >= 16)
|
||||
{
|
||||
@@ -169,7 +191,7 @@ first_literal_run:
|
||||
lit += 2;
|
||||
*litp = LZO_BYTE((*litp & ~3) | lit);
|
||||
/* copy over the 2 literals that replace the match */
|
||||
copy2(ip-2,m_pos,pd(op,m_pos));
|
||||
copy2(ip - 2, m_pos, pd(op, m_pos));
|
||||
o_m1_a++;
|
||||
}
|
||||
/* test if a literal run follows */
|
||||
@@ -180,25 +202,32 @@ first_literal_run:
|
||||
/* remove short run */
|
||||
*litp &= ~3;
|
||||
/* copy over the 2 literals that replace the match */
|
||||
copy2(ip-3+1,m_pos,pd(op,m_pos));
|
||||
copy2(ip - 3 + 1, m_pos, pd(op, m_pos));
|
||||
/* move literals 1 byte ahead */
|
||||
litp += 2;
|
||||
|
||||
if (lit > 0)
|
||||
lzo_memmove(litp+1,litp,lit);
|
||||
lzo_memmove(litp + 1, litp, lit);
|
||||
|
||||
/* insert new length of long literal run */
|
||||
lit += 2 + t + 3; assert(lit <= 18);
|
||||
lit += 2 + t + 3;
|
||||
assert(lit <= 18);
|
||||
*litp = LZO_BYTE(lit - 3);
|
||||
|
||||
o_m1_b++;
|
||||
*op++ = *m_pos++; *op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
goto copy_literal_run;
|
||||
}
|
||||
|
||||
copy_m1:
|
||||
*op++ = *m_pos++; *op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
match:
|
||||
|
||||
if (t >= 64) /* a M2 match */
|
||||
{
|
||||
m_pos = op - 1;
|
||||
@@ -211,23 +240,28 @@ match:
|
||||
m_pos -= *ip++ << 2;
|
||||
t = (t >> 4) - 3;
|
||||
#endif
|
||||
|
||||
if (litp == NULL)
|
||||
goto copy_m;
|
||||
|
||||
nl = ip[-2] & 3;
|
||||
|
||||
/* test if in beetween two long literal runs */
|
||||
if (t == 1 && lit > 3 && nl == 0 &&
|
||||
ip[0] < 16 && ip[0] != 0 && (lit + 3 + ip[0] < 16))
|
||||
ip[0] < 16 && ip[0] != 0 && (lit + 3 + ip[0] < 16))
|
||||
{
|
||||
assert(*litp == lit - 3);
|
||||
t = *ip++;
|
||||
/* copy over the 3 literals that replace the match */
|
||||
copy3(ip-1-2,m_pos,pd(op,m_pos));
|
||||
copy3(ip - 1 - 2, m_pos, pd(op, m_pos));
|
||||
/* set new length of previous literal run */
|
||||
lit += 3 + t + 3; assert(lit <= 18);
|
||||
lit += 3 + t + 3;
|
||||
assert(lit <= 18);
|
||||
*litp = LZO_BYTE(lit - 3);
|
||||
o_m2++;
|
||||
*op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
goto copy_literal_run;
|
||||
}
|
||||
}
|
||||
@@ -236,13 +270,17 @@ match:
|
||||
if (t >= 32) /* a M3 match */
|
||||
{
|
||||
t &= 31;
|
||||
|
||||
if (t == 0)
|
||||
{
|
||||
t = 31;
|
||||
|
||||
while (*ip == 0)
|
||||
t += 255, ip++;
|
||||
|
||||
t += *ip++;
|
||||
}
|
||||
|
||||
m_pos = op - 1;
|
||||
m_pos -= *ip++ >> 2;
|
||||
m_pos -= *ip++ << 6;
|
||||
@@ -252,23 +290,31 @@ match:
|
||||
m_pos = op;
|
||||
m_pos -= (t & 8) << 11;
|
||||
t &= 7;
|
||||
|
||||
if (t == 0)
|
||||
{
|
||||
t = 7;
|
||||
|
||||
while (*ip == 0)
|
||||
t += 255, ip++;
|
||||
|
||||
t += *ip++;
|
||||
}
|
||||
|
||||
m_pos -= *ip++ >> 2;
|
||||
m_pos -= *ip++ << 6;
|
||||
|
||||
if (m_pos == op)
|
||||
goto eof_found;
|
||||
|
||||
m_pos -= 0x4000;
|
||||
}
|
||||
|
||||
if (litp == NULL)
|
||||
goto copy_m;
|
||||
|
||||
nl = ip[-2] & 3;
|
||||
|
||||
/* test if in beetween two matches */
|
||||
if (t == 1 && lit == 0 && nl == 0 && ip[0] >= 16)
|
||||
{
|
||||
@@ -279,7 +325,7 @@ match:
|
||||
lit += 3;
|
||||
*litp = LZO_BYTE((*litp & ~3) | lit);
|
||||
/* copy over the 3 literals that replace the match */
|
||||
copy3(ip-3,m_pos,pd(op,m_pos));
|
||||
copy3(ip - 3, m_pos, pd(op, m_pos));
|
||||
o_m3_a++;
|
||||
}
|
||||
/* test if a literal run follows */
|
||||
@@ -292,26 +338,37 @@ match:
|
||||
/* remove short run */
|
||||
*litp &= ~3;
|
||||
/* copy over the 3 literals that replace the match */
|
||||
copy3(ip-4+1,m_pos,pd(op,m_pos));
|
||||
copy3(ip - 4 + 1, m_pos, pd(op, m_pos));
|
||||
/* move literals 1 byte ahead */
|
||||
litp += 2;
|
||||
|
||||
if (lit > 0)
|
||||
lzo_memmove(litp+1,litp,lit);
|
||||
lzo_memmove(litp + 1, litp, lit);
|
||||
|
||||
/* insert new length of long literal run */
|
||||
lit += 3 + t + 3; assert(lit <= 18);
|
||||
lit += 3 + t + 3;
|
||||
assert(lit <= 18);
|
||||
*litp = LZO_BYTE(lit - 3);
|
||||
|
||||
o_m3_b++;
|
||||
*op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
goto copy_literal_run;
|
||||
}
|
||||
}
|
||||
|
||||
copy_m:
|
||||
*op++ = *m_pos++; *op++ = *m_pos++;
|
||||
do *op++ = *m_pos++; while (--t > 0);
|
||||
*op++ = *m_pos++;
|
||||
*op++ = *m_pos++;
|
||||
|
||||
do* op++ = *m_pos++;
|
||||
|
||||
while (--t > 0);
|
||||
}
|
||||
|
||||
match_done:
|
||||
|
||||
if (next_lit == NO_LIT)
|
||||
{
|
||||
t = ip[-2] & 3;
|
||||
@@ -320,15 +377,23 @@ match_done:
|
||||
}
|
||||
else
|
||||
t = next_lit;
|
||||
|
||||
assert(t <= 3);
|
||||
next_lit = NO_LIT;
|
||||
|
||||
if (t == 0)
|
||||
break;
|
||||
|
||||
/* copy literals */
|
||||
match_next:
|
||||
do *op++ = *ip++; while (--t > 0);
|
||||
|
||||
do* op++ = *ip++;
|
||||
|
||||
while (--t > 0);
|
||||
|
||||
t = *ip++;
|
||||
} while (TEST_IP_AND_TEST_OP);
|
||||
}
|
||||
while (TEST_IP_AND_TEST_OP);
|
||||
}
|
||||
|
||||
/* no EOF code was found */
|
||||
@@ -341,11 +406,14 @@ eof_found:
|
||||
printf("optimize: %5lu %5lu %5lu %5lu %5lu\n",
|
||||
o_m1_a, o_m1_b, o_m2, o_m3_a, o_m3_b);
|
||||
#endif
|
||||
LZO_UNUSED(o_m1_a); LZO_UNUSED(o_m1_b); LZO_UNUSED(o_m2);
|
||||
LZO_UNUSED(o_m3_a); LZO_UNUSED(o_m3_b);
|
||||
LZO_UNUSED(o_m1_a);
|
||||
LZO_UNUSED(o_m1_b);
|
||||
LZO_UNUSED(o_m2);
|
||||
LZO_UNUSED(o_m3_a);
|
||||
LZO_UNUSED(o_m3_b);
|
||||
*out_len = pd(op, out);
|
||||
return (ip == ip_end ? LZO_E_OK :
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
}
|
||||
|
||||
|
||||
|
||||
24
extern/lzo/src/lzo1y_d2.c
vendored
24
extern/lzo/src/lzo1y_d2.c
vendored
@@ -35,24 +35,24 @@
|
||||
|
||||
#if defined(LZO_ARCH_I386) && defined(LZO_USE_ASM)
|
||||
LZO_EXTERN(int) lzo1y_decompress_asm_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_PUBLIC(int) lzo1y_decompress_asm_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem)
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return lzo1y_decompress_safe(src, src_len, dst, dst_len, wrkmem);
|
||||
}
|
||||
LZO_EXTERN(int) lzo1y_decompress_asm_fast_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem);
|
||||
LZO_PUBLIC(int) lzo1y_decompress_asm_fast_safe
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem)
|
||||
(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return lzo1y_decompress_safe(src, src_len, dst, dst_len, wrkmem);
|
||||
}
|
||||
|
||||
120
extern/lzo/src/lzo2a_9x.c
vendored
120
extern/lzo/src/lzo2a_9x.c
vendored
@@ -46,7 +46,7 @@
|
||||
|
||||
#if (LZO_CC_BORLANDC && LZO_MM_FLAT)
|
||||
# if ((__BORLANDC__) >= 0x0450 && (__BORLANDC__) < 0x0460)
|
||||
/* avoid internal compiler error */
|
||||
/* avoid internal compiler error */
|
||||
# pragma option -Od
|
||||
# endif
|
||||
#endif
|
||||
@@ -72,24 +72,24 @@
|
||||
************************************************************************/
|
||||
|
||||
LZO_EXTERN(int)
|
||||
lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain );
|
||||
lzo2a_999_compress_callback(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain);
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain )
|
||||
lzo2a_999_compress_callback(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem,
|
||||
lzo_callback_p cb,
|
||||
lzo_uint max_chain)
|
||||
{
|
||||
lzo_bytep op;
|
||||
lzo_bytep bitp = 0;
|
||||
lzo_uint m_len, m_off;
|
||||
LZO_COMPRESS_T cc;
|
||||
LZO_COMPRESS_T * const c = &cc;
|
||||
LZO_COMPRESS_T* const c = &cc;
|
||||
lzo_swd_p const swd = (lzo_swd_p) wrkmem;
|
||||
int r;
|
||||
|
||||
@@ -107,15 +107,19 @@ lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
op = out;
|
||||
|
||||
r = init_match(c,swd,NULL,0,0);
|
||||
r = init_match(c, swd, NULL, 0, 0);
|
||||
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
if (max_chain > 0)
|
||||
swd->max_chain = max_chain;
|
||||
|
||||
r = find_match(c,swd,0,0);
|
||||
r = find_match(c, swd, 0, 0);
|
||||
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
while (c->look > 0)
|
||||
{
|
||||
lzo_uint lazy_match_min_gain = 0;
|
||||
@@ -129,6 +133,7 @@ lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
m_off = c->m_off;
|
||||
|
||||
#if (SWD_N >= 8192)
|
||||
|
||||
if (m_off >= 8192)
|
||||
{
|
||||
if (m_len < M3_MIN_LEN)
|
||||
@@ -138,25 +143,25 @@ lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (m_len >= M1_MIN_LEN && m_len <= M1_MAX_LEN && m_off <= 256)
|
||||
{
|
||||
lazy_match_min_gain = 2;
|
||||
if (m_len >= M1_MIN_LEN && m_len <= M1_MAX_LEN && m_off <= 256)
|
||||
{
|
||||
lazy_match_min_gain = 2;
|
||||
#if (SWD_N >= 8192)
|
||||
extra1 = 3;
|
||||
extra1 = 3;
|
||||
#endif
|
||||
extra2 = 2;
|
||||
}
|
||||
else if (m_len >= 10)
|
||||
lazy_match_min_gain = 1;
|
||||
else if (m_len >= 3)
|
||||
{
|
||||
lazy_match_min_gain = 1;
|
||||
extra2 = 2;
|
||||
}
|
||||
else if (m_len >= 10)
|
||||
lazy_match_min_gain = 1;
|
||||
else if (m_len >= 3)
|
||||
{
|
||||
lazy_match_min_gain = 1;
|
||||
#if (SWD_N >= 8192)
|
||||
extra1 = 1;
|
||||
extra1 = 1;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
m_len = 0;
|
||||
}
|
||||
else
|
||||
m_len = 0;
|
||||
|
||||
|
||||
/* try a lazy match */
|
||||
@@ -164,25 +169,28 @@ lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
{
|
||||
unsigned char lit = LZO_BYTE(swd->b_char);
|
||||
|
||||
r = find_match(c,swd,1,0);
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
r = find_match(c, swd, 1, 0);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
assert(c->look > 0);
|
||||
|
||||
#if (SWD_N >= 8192)
|
||||
|
||||
if (m_off < 8192 && c->m_off >= 8192)
|
||||
lazy_match_min_gain += extra1;
|
||||
else
|
||||
#endif
|
||||
if (m_len >= M1_MIN_LEN && m_len <= M1_MAX_LEN && m_off <= 256)
|
||||
{
|
||||
if (!(c->m_len >= M1_MIN_LEN &&
|
||||
c->m_len <= M1_MAX_LEN && c->m_off <= 256))
|
||||
lazy_match_min_gain += extra2;
|
||||
}
|
||||
if (m_len >= M1_MIN_LEN && m_len <= M1_MAX_LEN && m_off <= 256)
|
||||
{
|
||||
if (!(c->m_len >= M1_MIN_LEN &&
|
||||
c->m_len <= M1_MAX_LEN && c->m_off <= 256))
|
||||
lazy_match_min_gain += extra2;
|
||||
}
|
||||
|
||||
if (c->m_len >= M1_MIN_LEN &&
|
||||
c->m_len <= M1_MAX_LEN && c->m_off <= 256)
|
||||
c->m_len <= M1_MAX_LEN && c->m_off <= 256)
|
||||
{
|
||||
lazy_match_min_gain -= 1;
|
||||
lazy_match_min_gain -= 1;
|
||||
}
|
||||
|
||||
if ((lzo_int) lazy_match_min_gain < 1)
|
||||
@@ -206,6 +214,7 @@ lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
}
|
||||
else
|
||||
ahead = 1;
|
||||
|
||||
assert(m_len > 0);
|
||||
}
|
||||
|
||||
@@ -216,8 +225,9 @@ lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
putbit(0);
|
||||
putbyte(swd->b_char);
|
||||
c->lit_bytes++;
|
||||
r = find_match(c,swd,1,0);
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
r = find_match(c, swd, 1, 0);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -230,10 +240,11 @@ lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
{
|
||||
putbit(1);
|
||||
putbit(0);
|
||||
putbits(2,m_len - M1_MIN_LEN);
|
||||
putbits(2, m_len - M1_MIN_LEN);
|
||||
putbyte(m_off - 1);
|
||||
c->m1++;
|
||||
}
|
||||
|
||||
#if (SWD_N >= 8192)
|
||||
else if (m_off >= 8192)
|
||||
{
|
||||
@@ -245,14 +256,17 @@ lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
putbyte(m_off >> 5);
|
||||
putbit(1);
|
||||
len -= M3_MIN_LEN - 1;
|
||||
|
||||
while (len > 255)
|
||||
{
|
||||
len -= 255;
|
||||
putbyte(0);
|
||||
}
|
||||
|
||||
putbyte(len);
|
||||
c->m4++;
|
||||
}
|
||||
|
||||
#endif
|
||||
else
|
||||
{
|
||||
@@ -260,6 +274,7 @@ lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
putbit(1);
|
||||
putbit(1);
|
||||
|
||||
if (m_len <= 9)
|
||||
{
|
||||
putbyte(((m_len - 2) << 5) | (m_off & 31));
|
||||
@@ -275,17 +290,21 @@ lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
putbit(0);
|
||||
#endif
|
||||
len -= 10 - 1;
|
||||
|
||||
while (len > 255)
|
||||
{
|
||||
len -= 255;
|
||||
putbyte(0);
|
||||
}
|
||||
|
||||
putbyte(len);
|
||||
c->m3++;
|
||||
}
|
||||
}
|
||||
r = find_match(c,swd,m_len,1+ahead);
|
||||
assert(r == 0); LZO_UNUSED(r);
|
||||
|
||||
r = find_match(c, swd, m_len, 1 + ahead);
|
||||
assert(r == 0);
|
||||
LZO_UNUSED(r);
|
||||
}
|
||||
|
||||
c->codesize = pd(op, out);
|
||||
@@ -301,6 +320,7 @@ lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
/* flush remaining bits */
|
||||
assert(k < CHAR_BIT);
|
||||
|
||||
if (k > 0)
|
||||
{
|
||||
assert(b == MASKBITS(k));
|
||||
@@ -321,8 +341,8 @@ lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
|
||||
#if 0
|
||||
printf("%ld -> %ld: %ld %ld %ld %ld %ld %ld\n",
|
||||
(long) c->textsize, (long) c->codesize,
|
||||
c->lit_bytes, c->m1, c->m2, c->m3, c->m4, c->lazy);
|
||||
(long) c->textsize, (long) c->codesize,
|
||||
c->lit_bytes, c->m1, c->m2, c->m3, c->m4, c->lazy);
|
||||
#endif
|
||||
return LZO_E_OK;
|
||||
}
|
||||
@@ -334,11 +354,11 @@ lzo2a_999_compress_callback ( const lzo_bytep in , lzo_uint in_len,
|
||||
************************************************************************/
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
lzo2a_999_compress ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
lzo2a_999_compress(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
return lzo2a_999_compress_callback(in,in_len,out,out_len,wrkmem,
|
||||
return lzo2a_999_compress_callback(in, in_len, out, out_len, wrkmem,
|
||||
(lzo_callback_p) 0, 0);
|
||||
}
|
||||
|
||||
|
||||
38
extern/lzo/src/lzo2a_d.ch
vendored
38
extern/lzo/src/lzo2a_d.ch
vendored
@@ -37,9 +37,9 @@
|
||||
#define _NEXTBYTE (*ip++)
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem )
|
||||
DO_DECOMPRESS(const lzo_bytep in , lzo_uint in_len,
|
||||
lzo_bytep out, lzo_uintp out_len,
|
||||
lzo_voidp wrkmem)
|
||||
{
|
||||
lzo_bytep op;
|
||||
const lzo_bytep ip;
|
||||
@@ -62,17 +62,21 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
while (TEST_IP_AND_TEST_OP)
|
||||
{
|
||||
NEEDBITS(1);
|
||||
|
||||
if (MASKBITS(1) == 0)
|
||||
{
|
||||
DUMPBITS(1);
|
||||
/* a literal */
|
||||
NEED_IP(1); NEED_OP(1);
|
||||
NEED_IP(1);
|
||||
NEED_OP(1);
|
||||
*op++ = *ip++;
|
||||
continue;
|
||||
}
|
||||
|
||||
DUMPBITS(1);
|
||||
|
||||
NEEDBITS(1);
|
||||
|
||||
if (MASKBITS(1) == 0)
|
||||
{
|
||||
DUMPBITS(1);
|
||||
@@ -80,26 +84,31 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
NEEDBITS(2);
|
||||
t = M1_MIN_LEN + (lzo_uint) MASKBITS(2);
|
||||
DUMPBITS(2);
|
||||
NEED_IP(1); NEED_OP(t);
|
||||
NEED_IP(1);
|
||||
NEED_OP(t);
|
||||
m_pos = op - 1 - *ip++;
|
||||
assert(m_pos >= out); assert(m_pos < op);
|
||||
assert(m_pos >= out);
|
||||
assert(m_pos < op);
|
||||
TEST_LB(m_pos);
|
||||
MEMCPY_DS(op,m_pos,t);
|
||||
MEMCPY_DS(op, m_pos, t);
|
||||
continue;
|
||||
}
|
||||
|
||||
DUMPBITS(1);
|
||||
|
||||
NEED_IP(2);
|
||||
t = *ip++;
|
||||
m_pos = op;
|
||||
m_pos -= (t & 31) | (((lzo_uint) *ip++) << 5);
|
||||
m_pos -= (t & 31) | (((lzo_uint) * ip++) << 5);
|
||||
t >>= 5;
|
||||
|
||||
if (t == 0)
|
||||
{
|
||||
#if (SWD_N >= 8192)
|
||||
NEEDBITS(1);
|
||||
t = MASKBITS(1);
|
||||
DUMPBITS(1);
|
||||
|
||||
if (t == 0)
|
||||
t = 10 - 1;
|
||||
else
|
||||
@@ -108,10 +117,12 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
m_pos -= 8192; /* t << 13 */
|
||||
t = M3_MIN_LEN - 1;
|
||||
}
|
||||
|
||||
#else
|
||||
t = 10 - 1;
|
||||
#endif
|
||||
NEED_IP(1);
|
||||
|
||||
while (*ip == 0)
|
||||
{
|
||||
t += 255;
|
||||
@@ -119,20 +130,25 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len,
|
||||
TEST_OV(t);
|
||||
NEED_IP(1);
|
||||
}
|
||||
|
||||
t += *ip++;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(LZO_EOF_CODE)
|
||||
|
||||
if (m_pos == op)
|
||||
goto eof_found;
|
||||
|
||||
#endif
|
||||
t += 2;
|
||||
}
|
||||
assert(m_pos >= out); assert(m_pos < op);
|
||||
|
||||
assert(m_pos >= out);
|
||||
assert(m_pos < op);
|
||||
TEST_LB(m_pos);
|
||||
NEED_OP(t);
|
||||
MEMCPY_DS(op,m_pos,t);
|
||||
MEMCPY_DS(op, m_pos, t);
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +164,7 @@ eof_found:
|
||||
#endif
|
||||
*out_len = pd(op, out);
|
||||
return (ip == ip_end ? LZO_E_OK :
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
(ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
|
||||
|
||||
|
||||
#if defined(HAVE_NEED_IP)
|
||||
|
||||
20
extern/lzo/src/lzo_conf.h
vendored
20
extern/lzo/src/lzo_conf.h
vendored
@@ -47,7 +47,7 @@
|
||||
# error "include this file first"
|
||||
#endif
|
||||
#if defined(LZO_CFG_BUILD_DLL) && (LZO_CFG_BUILD_DLL+0) && !defined(__LZO_EXPORT1) && !defined(__LZO_EXPORT2) && 0
|
||||
/* idea: we could auto-define __LZO_EXPORT1 for DLL exports */
|
||||
/* idea: we could auto-define __LZO_EXPORT1 for DLL exports */
|
||||
#ifndef __LZODEFS_H_INCLUDED
|
||||
#if defined(LZO_HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
@@ -56,8 +56,8 @@
|
||||
#include <stddef.h>
|
||||
#include <lzo/lzodefs.h>
|
||||
#endif
|
||||
/* #define __LZO_EXPORT1 __attribute__((__visibility__("default"))) */
|
||||
/* #define __LZO_EXPORT1 __declspec(dllexport) */
|
||||
/* #define __LZO_EXPORT1 __attribute__((__visibility__("default"))) */
|
||||
/* #define __LZO_EXPORT1 __declspec(dllexport) */
|
||||
#endif
|
||||
#include <lzo/lzoconf.h>
|
||||
#if defined(LZO_CFG_EXTRA_CONFIG_HEADER2)
|
||||
@@ -75,24 +75,24 @@
|
||||
************************************************************************/
|
||||
|
||||
#if (LZO_CC_MSC && (_MSC_VER >= 1000 && _MSC_VER < 1100))
|
||||
/* disable bogus "unreachable code" warnings */
|
||||
/* disable bogus "unreachable code" warnings */
|
||||
# pragma warning(disable: 4702)
|
||||
#endif
|
||||
#if (LZO_CC_MSC && (_MSC_VER >= 1000))
|
||||
# pragma warning(disable: 4127 4701)
|
||||
/* disable warnings about inlining */
|
||||
/* disable warnings about inlining */
|
||||
# pragma warning(disable: 4514 4710 4711)
|
||||
#endif
|
||||
#if (LZO_CC_MSC && (_MSC_VER >= 1300))
|
||||
/* disable '-Wall' warnings in system header files */
|
||||
/* disable '-Wall' warnings in system header files */
|
||||
# pragma warning(disable: 4820)
|
||||
#endif
|
||||
#if (LZO_CC_MSC && (_MSC_VER >= 1800))
|
||||
/* disable '-Wall' warnings in system header files */
|
||||
/* disable '-Wall' warnings in system header files */
|
||||
# pragma warning(disable: 4746)
|
||||
#endif
|
||||
#if (LZO_CC_INTELC && (__INTEL_COMPILER >= 900))
|
||||
/* disable pedantic warnings in system header files */
|
||||
/* disable pedantic warnings in system header files */
|
||||
# pragma warning(disable: 1684)
|
||||
#endif
|
||||
|
||||
@@ -277,8 +277,8 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint64_t) == 8)
|
||||
|
||||
#if !defined(DMUL)
|
||||
#if 0
|
||||
/* 32*32 multiplies may be faster than 64*64 on some 64-bit machines,
|
||||
* but then we need extra casts from unsigned<->size_t */
|
||||
/* 32*32 multiplies may be faster than 64*64 on some 64-bit machines,
|
||||
* but then we need extra casts from unsigned<->size_t */
|
||||
# define DMUL(a,b) ((lzo_xint) ((lzo_uint32_t)(a) * (lzo_uint32_t)(b)))
|
||||
#else
|
||||
# define DMUL(a,b) ((lzo_xint) ((a) * (b)))
|
||||
|
||||
133
extern/lzo/src/lzo_crc.c
vendored
133
extern/lzo/src/lzo_crc.c
vendored
@@ -35,59 +35,60 @@
|
||||
// see http://www.zlib.org/
|
||||
************************************************************************/
|
||||
|
||||
static const lzo_uint32_t lzo_crc32_table[256] = {
|
||||
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
|
||||
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
|
||||
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
|
||||
0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
|
||||
0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
|
||||
0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
|
||||
0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
|
||||
0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
|
||||
0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
|
||||
0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
|
||||
0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
|
||||
0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
|
||||
0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
|
||||
0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
|
||||
0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
|
||||
0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
|
||||
0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
|
||||
0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
|
||||
0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
|
||||
0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
|
||||
0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
|
||||
0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
|
||||
0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
|
||||
0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
|
||||
0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
|
||||
0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
|
||||
0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
|
||||
0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
|
||||
0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
|
||||
0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
|
||||
0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
|
||||
0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
|
||||
0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
|
||||
0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
|
||||
0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
|
||||
0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
|
||||
0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
|
||||
0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
|
||||
0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
|
||||
0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
|
||||
0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
|
||||
0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
|
||||
0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
|
||||
0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
|
||||
0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
|
||||
0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
|
||||
0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
|
||||
0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
|
||||
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
|
||||
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
|
||||
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
|
||||
0x2d02ef8dL
|
||||
static const lzo_uint32_t lzo_crc32_table[256] =
|
||||
{
|
||||
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
|
||||
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
|
||||
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
|
||||
0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
|
||||
0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
|
||||
0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
|
||||
0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
|
||||
0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
|
||||
0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
|
||||
0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
|
||||
0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
|
||||
0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
|
||||
0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
|
||||
0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
|
||||
0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
|
||||
0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
|
||||
0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
|
||||
0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
|
||||
0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
|
||||
0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
|
||||
0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
|
||||
0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
|
||||
0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
|
||||
0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
|
||||
0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
|
||||
0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
|
||||
0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
|
||||
0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
|
||||
0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
|
||||
0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
|
||||
0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
|
||||
0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
|
||||
0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
|
||||
0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
|
||||
0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
|
||||
0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
|
||||
0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
|
||||
0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
|
||||
0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
|
||||
0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
|
||||
0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
|
||||
0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
|
||||
0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
|
||||
0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
|
||||
0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
|
||||
0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
|
||||
0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
|
||||
0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
|
||||
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
|
||||
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
|
||||
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
|
||||
0x2d02ef8dL
|
||||
};
|
||||
|
||||
|
||||
@@ -119,25 +120,29 @@ lzo_crc32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len)
|
||||
#if 1
|
||||
# define table lzo_crc32_table
|
||||
#else
|
||||
const lzo_uint32_t * table = lzo_crc32_table;
|
||||
const lzo_uint32_t* table = lzo_crc32_table;
|
||||
#endif
|
||||
|
||||
if (buf == NULL)
|
||||
return 0;
|
||||
|
||||
crc = (c & LZO_UINT32_C(0xffffffff)) ^ LZO_UINT32_C(0xffffffff);
|
||||
|
||||
if (len >= 16) do
|
||||
{
|
||||
LZO_DO16(buf,0);
|
||||
buf += 16;
|
||||
len -= 16;
|
||||
} while (len >= 16);
|
||||
{
|
||||
LZO_DO16(buf, 0);
|
||||
buf += 16;
|
||||
len -= 16;
|
||||
}
|
||||
while (len >= 16);
|
||||
|
||||
if (len != 0) do
|
||||
{
|
||||
LZO_DO1(buf,0);
|
||||
buf += 1;
|
||||
len -= 1;
|
||||
} while (len > 0);
|
||||
{
|
||||
LZO_DO1(buf, 0);
|
||||
buf += 1;
|
||||
len -= 1;
|
||||
}
|
||||
while (len > 0);
|
||||
|
||||
return crc ^ LZO_UINT32_C(0xffffffff);
|
||||
#undef table
|
||||
|
||||
12
extern/lzo/src/lzo_dict.h
vendored
12
extern/lzo/src/lzo_dict.h
vendored
@@ -152,11 +152,11 @@ extern "C" {
|
||||
|
||||
|
||||
#if (LZO_HASH == LZO_HASH_GZIP)
|
||||
/* hash function like in gzip/zlib (deflate) */
|
||||
/* hash function like in gzip/zlib (deflate) */
|
||||
# define _DINDEX(dv,p) (_DV_A((p),DL_SHIFT))
|
||||
|
||||
#elif (LZO_HASH == LZO_HASH_GZIP_INCREMENTAL)
|
||||
/* incremental hash like in gzip/zlib (deflate) */
|
||||
/* incremental hash like in gzip/zlib (deflate) */
|
||||
# define __LZO_HASH_INCREMENTAL 1
|
||||
# define DVAL_FIRST(dv,p) dv = _DV_A((p),DL_SHIFT)
|
||||
# define DVAL_NEXT(dv,p) dv = (((dv) << DL_SHIFT) ^ p[2])
|
||||
@@ -164,7 +164,7 @@ extern "C" {
|
||||
# define DVAL_LOOKAHEAD DL_MIN_LEN
|
||||
|
||||
#elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_A)
|
||||
/* incremental LZO hash version A */
|
||||
/* incremental LZO hash version A */
|
||||
# define __LZO_HASH_INCREMENTAL 1
|
||||
# define DVAL_FIRST(dv,p) dv = _DV_A((p),5)
|
||||
# define DVAL_NEXT(dv,p) \
|
||||
@@ -173,7 +173,7 @@ extern "C" {
|
||||
# define DVAL_LOOKAHEAD DL_MIN_LEN
|
||||
|
||||
#elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_B)
|
||||
/* incremental LZO hash version B */
|
||||
/* incremental LZO hash version B */
|
||||
# define __LZO_HASH_INCREMENTAL 1
|
||||
# define DVAL_FIRST(dv,p) dv = _DV_B((p),5)
|
||||
# define DVAL_NEXT(dv,p) \
|
||||
@@ -215,8 +215,8 @@ static void
|
||||
DVAL_ASSERT(lzo_xint dv, const lzo_bytep p)
|
||||
{
|
||||
lzo_xint df;
|
||||
DVAL_FIRST(df,(p));
|
||||
assert(DINDEX(dv,p) == DINDEX(df,p));
|
||||
DVAL_FIRST(df, (p));
|
||||
assert(DINDEX(dv, p) == DINDEX(df, p));
|
||||
}
|
||||
#else
|
||||
# define DVAL_ASSERT(dv,p) ((void) 0)
|
||||
|
||||
11
extern/lzo/src/lzo_dll.ch
vendored
11
extern/lzo/src/lzo_dll.ch
vendored
@@ -34,13 +34,16 @@
|
||||
|
||||
/* don't pull in <windows.h> - we don't need it */
|
||||
#if 0
|
||||
BOOL FAR PASCAL LibMain ( HANDLE hInstance, WORD wDataSegment,
|
||||
WORD wHeapSize, LPSTR lpszCmdLine )
|
||||
BOOL FAR PASCAL LibMain(HANDLE hInstance, WORD wDataSegment,
|
||||
WORD wHeapSize, LPSTR lpszCmdLine)
|
||||
#else
|
||||
int __far __pascal LibMain ( int a, short b, short c, long d )
|
||||
int __far __pascal LibMain(int a, short b, short c, long d)
|
||||
#endif
|
||||
{
|
||||
LZO_UNUSED(a); LZO_UNUSED(b); LZO_UNUSED(c); LZO_UNUSED(d);
|
||||
LZO_UNUSED(a);
|
||||
LZO_UNUSED(b);
|
||||
LZO_UNUSED(c);
|
||||
LZO_UNUSED(d);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
100
extern/lzo/src/lzo_func.h
vendored
100
extern/lzo/src/lzo_func.h
vendored
@@ -64,21 +64,28 @@
|
||||
__lzo_static_forceinline unsigned lzo_bitops_ctlz32_func(lzo_uint32_t v)
|
||||
{
|
||||
#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
|
||||
unsigned long r; (void) _BitScanReverse(&r, v); return (unsigned) r ^ 31;
|
||||
unsigned long r;
|
||||
(void) _BitScanReverse(&r, v);
|
||||
return (unsigned) r ^ 31;
|
||||
#define lzo_bitops_ctlz32(v) lzo_bitops_ctlz32_func(v)
|
||||
#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC)
|
||||
lzo_uint32_t r;
|
||||
__asm__("bsr %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC);
|
||||
__asm__("bsr %1,%0" : "=r"(r) : "rm"(v) __LZO_ASM_CLOBBER_LIST_CC);
|
||||
return (unsigned) r ^ 31;
|
||||
#define lzo_bitops_ctlz32(v) lzo_bitops_ctlz32_func(v)
|
||||
#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_INT == 4)
|
||||
unsigned r; r = (unsigned) __builtin_clz(v); return r;
|
||||
unsigned r;
|
||||
r = (unsigned) __builtin_clz(v);
|
||||
return r;
|
||||
#define lzo_bitops_ctlz32(v) ((unsigned) __builtin_clz(v))
|
||||
#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG == 8) && (LZO_WORDSIZE >= 8)
|
||||
unsigned r; r = (unsigned) __builtin_clzl(v); return r ^ 32;
|
||||
unsigned r;
|
||||
r = (unsigned) __builtin_clzl(v);
|
||||
return r ^ 32;
|
||||
#define lzo_bitops_ctlz32(v) (((unsigned) __builtin_clzl(v)) ^ 32)
|
||||
#else
|
||||
LZO_UNUSED(v); return 0;
|
||||
LZO_UNUSED(v);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -86,21 +93,28 @@ __lzo_static_forceinline unsigned lzo_bitops_ctlz32_func(lzo_uint32_t v)
|
||||
__lzo_static_forceinline unsigned lzo_bitops_ctlz64_func(lzo_uint64_t v)
|
||||
{
|
||||
#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64)
|
||||
unsigned long r; (void) _BitScanReverse64(&r, v); return (unsigned) r ^ 63;
|
||||
unsigned long r;
|
||||
(void) _BitScanReverse64(&r, v);
|
||||
return (unsigned) r ^ 63;
|
||||
#define lzo_bitops_ctlz64(v) lzo_bitops_ctlz64_func(v)
|
||||
#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64) && (LZO_ASM_SYNTAX_GNUC)
|
||||
lzo_uint64_t r;
|
||||
__asm__("bsr %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC);
|
||||
__asm__("bsr %1,%0" : "=r"(r) : "rm"(v) __LZO_ASM_CLOBBER_LIST_CC);
|
||||
return (unsigned) r ^ 63;
|
||||
#define lzo_bitops_ctlz64(v) lzo_bitops_ctlz64_func(v)
|
||||
#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG == 8) && (LZO_WORDSIZE >= 8)
|
||||
unsigned r; r = (unsigned) __builtin_clzl(v); return r;
|
||||
unsigned r;
|
||||
r = (unsigned) __builtin_clzl(v);
|
||||
return r;
|
||||
#define lzo_bitops_ctlz64(v) ((unsigned) __builtin_clzl(v))
|
||||
#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG_LONG == 8) && (LZO_WORDSIZE >= 8)
|
||||
unsigned r; r = (unsigned) __builtin_clzll(v); return r;
|
||||
unsigned r;
|
||||
r = (unsigned) __builtin_clzll(v);
|
||||
return r;
|
||||
#define lzo_bitops_ctlz64(v) ((unsigned) __builtin_clzll(v))
|
||||
#else
|
||||
LZO_UNUSED(v); return 0;
|
||||
LZO_UNUSED(v);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -108,18 +122,23 @@ __lzo_static_forceinline unsigned lzo_bitops_ctlz64_func(lzo_uint64_t v)
|
||||
__lzo_static_forceinline unsigned lzo_bitops_cttz32_func(lzo_uint32_t v)
|
||||
{
|
||||
#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
|
||||
unsigned long r; (void) _BitScanForward(&r, v); return (unsigned) r;
|
||||
unsigned long r;
|
||||
(void) _BitScanForward(&r, v);
|
||||
return (unsigned) r;
|
||||
#define lzo_bitops_cttz32(v) lzo_bitops_cttz32_func(v)
|
||||
#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC)
|
||||
lzo_uint32_t r;
|
||||
__asm__("bsf %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC);
|
||||
__asm__("bsf %1,%0" : "=r"(r) : "rm"(v) __LZO_ASM_CLOBBER_LIST_CC);
|
||||
return (unsigned) r;
|
||||
#define lzo_bitops_cttz32(v) lzo_bitops_cttz32_func(v)
|
||||
#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_INT >= 4)
|
||||
unsigned r; r = (unsigned) __builtin_ctz(v); return r;
|
||||
unsigned r;
|
||||
r = (unsigned) __builtin_ctz(v);
|
||||
return r;
|
||||
#define lzo_bitops_cttz32(v) ((unsigned) __builtin_ctz(v))
|
||||
#else
|
||||
LZO_UNUSED(v); return 0;
|
||||
LZO_UNUSED(v);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -127,21 +146,28 @@ __lzo_static_forceinline unsigned lzo_bitops_cttz32_func(lzo_uint32_t v)
|
||||
__lzo_static_forceinline unsigned lzo_bitops_cttz64_func(lzo_uint64_t v)
|
||||
{
|
||||
#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64)
|
||||
unsigned long r; (void) _BitScanForward64(&r, v); return (unsigned) r;
|
||||
unsigned long r;
|
||||
(void) _BitScanForward64(&r, v);
|
||||
return (unsigned) r;
|
||||
#define lzo_bitops_cttz64(v) lzo_bitops_cttz64_func(v)
|
||||
#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64) && (LZO_ASM_SYNTAX_GNUC)
|
||||
lzo_uint64_t r;
|
||||
__asm__("bsf %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC);
|
||||
__asm__("bsf %1,%0" : "=r"(r) : "rm"(v) __LZO_ASM_CLOBBER_LIST_CC);
|
||||
return (unsigned) r;
|
||||
#define lzo_bitops_cttz64(v) lzo_bitops_cttz64_func(v)
|
||||
#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG >= 8) && (LZO_WORDSIZE >= 8)
|
||||
unsigned r; r = (unsigned) __builtin_ctzl(v); return r;
|
||||
unsigned r;
|
||||
r = (unsigned) __builtin_ctzl(v);
|
||||
return r;
|
||||
#define lzo_bitops_cttz64(v) ((unsigned) __builtin_ctzl(v))
|
||||
#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG_LONG >= 8) && (LZO_WORDSIZE >= 8)
|
||||
unsigned r; r = (unsigned) __builtin_ctzll(v); return r;
|
||||
unsigned r;
|
||||
r = (unsigned) __builtin_ctzll(v);
|
||||
return r;
|
||||
#define lzo_bitops_cttz64(v) ((unsigned) __builtin_ctzll(v))
|
||||
#else
|
||||
LZO_UNUSED(v); return 0;
|
||||
LZO_UNUSED(v);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -179,7 +205,7 @@ lzo_unused_funcs_impl(void, lzo_bitops_unused_funcs)(void)
|
||||
typedef lzo_uint16_t __lzo_may_alias lzo_memops_TU2;
|
||||
#define lzo_memops_TU2p volatile lzo_memops_TU2 *
|
||||
#elif defined(__lzo_byte_struct)
|
||||
__lzo_byte_struct(lzo_memops_TU2_struct,2)
|
||||
__lzo_byte_struct(lzo_memops_TU2_struct, 2)
|
||||
typedef struct lzo_memops_TU2_struct lzo_memops_TU2;
|
||||
#else
|
||||
struct lzo_memops_TU2_struct { unsigned char a[2]; } __lzo_may_alias;
|
||||
@@ -194,7 +220,7 @@ typedef struct lzo_memops_TU2_struct lzo_memops_TU2;
|
||||
typedef lzo_uint32_t __lzo_may_alias lzo_memops_TU4;
|
||||
#define lzo_memops_TU4p volatile lzo_memops_TU4 __LZO_MMODEL *
|
||||
#elif defined(__lzo_byte_struct)
|
||||
__lzo_byte_struct(lzo_memops_TU4_struct,4)
|
||||
__lzo_byte_struct(lzo_memops_TU4_struct, 4)
|
||||
typedef struct lzo_memops_TU4_struct lzo_memops_TU4;
|
||||
#else
|
||||
struct lzo_memops_TU4_struct { unsigned char a[4]; } __lzo_may_alias;
|
||||
@@ -209,7 +235,7 @@ typedef struct lzo_memops_TU4_struct lzo_memops_TU4;
|
||||
typedef lzo_uint64_t __lzo_may_alias lzo_memops_TU8;
|
||||
#define lzo_memops_TU8p volatile lzo_memops_TU8 __LZO_MMODEL *
|
||||
#elif defined(__lzo_byte_struct)
|
||||
__lzo_byte_struct(lzo_memops_TU8_struct,8)
|
||||
__lzo_byte_struct(lzo_memops_TU8_struct, 8)
|
||||
typedef struct lzo_memops_TU8_struct lzo_memops_TU8;
|
||||
#else
|
||||
struct lzo_memops_TU8_struct { unsigned char a[8]; } __lzo_may_alias;
|
||||
@@ -276,10 +302,10 @@ typedef struct lzo_memops_TU8_struct lzo_memops_TU8;
|
||||
d__8[0] = s__8[0]; d__8[1] = s__8[1]; d__8[2] = s__8[2]; d__8[3] = s__8[3]; \
|
||||
d__8[4] = s__8[4]; d__8[5] = s__8[5]; d__8[6] = s__8[6]; d__8[7] = s__8[7]; \
|
||||
LZO_BLOCK_END
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU1p)0)==1)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU1p)0) == 1)
|
||||
#define LZO_MEMOPS_COPY1(dd,ss) LZO_MEMOPS_MOVE1(dd,ss)
|
||||
#if (LZO_OPT_UNALIGNED16)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU2p)0)==2)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU2p)0) == 2)
|
||||
#define LZO_MEMOPS_COPY2(dd,ss) \
|
||||
* (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss)
|
||||
#elif defined(lzo_memops_tcheck__)
|
||||
@@ -291,7 +317,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU2p)0)==2)
|
||||
#define LZO_MEMOPS_COPY2(dd,ss) LZO_MEMOPS_MOVE2(dd,ss)
|
||||
#endif
|
||||
#if (LZO_OPT_UNALIGNED32)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU4p)0)==4)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU4p)0) == 4)
|
||||
#define LZO_MEMOPS_COPY4(dd,ss) \
|
||||
* (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss)
|
||||
#elif defined(lzo_memops_tcheck__)
|
||||
@@ -307,7 +333,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU4p)0)==4)
|
||||
LZO_BLOCK_BEGIN LZO_MEMOPS_COPY4(dd,ss); LZO_MEMOPS_COPY4((lzo_memops_TU1p)(lzo_memops_TU0p)(dd)+4,(const lzo_memops_TU1p)(const lzo_memops_TU0p)(ss)+4); LZO_BLOCK_END
|
||||
#else
|
||||
#if (LZO_OPT_UNALIGNED64)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU8p)0)==8)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU8p)0) == 8)
|
||||
#define LZO_MEMOPS_COPY8(dd,ss) \
|
||||
* (lzo_memops_TU8p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss)
|
||||
#elif (LZO_OPT_UNALIGNED32)
|
||||
@@ -340,11 +366,11 @@ __lzo_static_forceinline lzo_uint16_t lzo_memops_get_le16(const lzo_voidp ss)
|
||||
#elif (LZO_OPT_UNALIGNED16 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC)
|
||||
const lzo_memops_TU2p s = (const lzo_memops_TU2p) ss;
|
||||
unsigned long vv;
|
||||
__asm__("lhbrx %0,0,%1" : "=r" (vv) : "r" (s), "m" (*s));
|
||||
__asm__("lhbrx %0,0,%1" : "=r"(vv) : "r"(s), "m"(*s));
|
||||
v = (lzo_uint16_t) vv;
|
||||
#else
|
||||
const lzo_memops_TU1p s = (const lzo_memops_TU1p) ss;
|
||||
v = (lzo_uint16_t) (((lzo_uint16_t)s[0]) | ((lzo_uint16_t)s[1] << 8));
|
||||
v = (lzo_uint16_t)(((lzo_uint16_t)s[0]) | ((lzo_uint16_t)s[1] << 8));
|
||||
#endif
|
||||
return v;
|
||||
}
|
||||
@@ -362,11 +388,11 @@ __lzo_static_forceinline lzo_uint32_t lzo_memops_get_le32(const lzo_voidp ss)
|
||||
#elif (LZO_OPT_UNALIGNED32 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC)
|
||||
const lzo_memops_TU4p s = (const lzo_memops_TU4p) ss;
|
||||
unsigned long vv;
|
||||
__asm__("lwbrx %0,0,%1" : "=r" (vv) : "r" (s), "m" (*s));
|
||||
__asm__("lwbrx %0,0,%1" : "=r"(vv) : "r"(s), "m"(*s));
|
||||
v = (lzo_uint32_t) vv;
|
||||
#else
|
||||
const lzo_memops_TU1p s = (const lzo_memops_TU1p) ss;
|
||||
v = (lzo_uint32_t) (((lzo_uint32_t)s[0]) | ((lzo_uint32_t)s[1] << 8) | ((lzo_uint32_t)s[2] << 16) | ((lzo_uint32_t)s[3] << 24));
|
||||
v = (lzo_uint32_t)(((lzo_uint32_t)s[0]) | ((lzo_uint32_t)s[1] << 8) | ((lzo_uint32_t)s[2] << 16) | ((lzo_uint32_t)s[3] << 24));
|
||||
#endif
|
||||
return v;
|
||||
}
|
||||
@@ -387,7 +413,7 @@ __lzo_static_forceinline lzo_uint16_t lzo_memops_get_ne16(const lzo_voidp ss)
|
||||
return v;
|
||||
}
|
||||
#if (LZO_OPT_UNALIGNED16)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU2p)0)==2)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU2p)0) == 2)
|
||||
#define LZO_MEMOPS_GET_NE16(ss) (* (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss))
|
||||
#else
|
||||
#define LZO_MEMOPS_GET_NE16(ss) lzo_memops_get_ne16(ss)
|
||||
@@ -400,14 +426,14 @@ __lzo_static_forceinline lzo_uint32_t lzo_memops_get_ne32(const lzo_voidp ss)
|
||||
return v;
|
||||
}
|
||||
#if (LZO_OPT_UNALIGNED32)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU4p)0)==4)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU4p)0) == 4)
|
||||
#define LZO_MEMOPS_GET_NE32(ss) (* (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss))
|
||||
#else
|
||||
#define LZO_MEMOPS_GET_NE32(ss) lzo_memops_get_ne32(ss)
|
||||
#endif
|
||||
|
||||
#if (LZO_OPT_UNALIGNED64)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU8p)0)==8)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU8p)0) == 8)
|
||||
#define LZO_MEMOPS_GET_NE64(ss) (* (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss))
|
||||
#endif
|
||||
|
||||
@@ -418,10 +444,10 @@ __lzo_static_forceinline void lzo_memops_put_le16(lzo_voidp dd, lzo_uint16_t vv)
|
||||
#elif (LZO_OPT_UNALIGNED16 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC)
|
||||
lzo_memops_TU2p d = (lzo_memops_TU2p) dd;
|
||||
unsigned long v = vv;
|
||||
__asm__("sthbrx %2,0,%1" : "=m" (*d) : "r" (d), "r" (v));
|
||||
__asm__("sthbrx %2,0,%1" : "=m"(*d) : "r"(d), "r"(v));
|
||||
#else
|
||||
lzo_memops_TU1p d = (lzo_memops_TU1p) dd;
|
||||
d[0] = LZO_BYTE((vv ) & 0xff);
|
||||
d[0] = LZO_BYTE((vv) & 0xff);
|
||||
d[1] = LZO_BYTE((vv >> 8) & 0xff);
|
||||
#endif
|
||||
}
|
||||
@@ -438,10 +464,10 @@ __lzo_static_forceinline void lzo_memops_put_le32(lzo_voidp dd, lzo_uint32_t vv)
|
||||
#elif (LZO_OPT_UNALIGNED32 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC)
|
||||
lzo_memops_TU4p d = (lzo_memops_TU4p) dd;
|
||||
unsigned long v = vv;
|
||||
__asm__("stwbrx %2,0,%1" : "=m" (*d) : "r" (d), "r" (v));
|
||||
__asm__("stwbrx %2,0,%1" : "=m"(*d) : "r"(d), "r"(v));
|
||||
#else
|
||||
lzo_memops_TU1p d = (lzo_memops_TU1p) dd;
|
||||
d[0] = LZO_BYTE((vv ) & 0xff);
|
||||
d[0] = LZO_BYTE((vv) & 0xff);
|
||||
d[1] = LZO_BYTE((vv >> 8) & 0xff);
|
||||
d[2] = LZO_BYTE((vv >> 16) & 0xff);
|
||||
d[3] = LZO_BYTE((vv >> 24) & 0xff);
|
||||
|
||||
104
extern/lzo/src/lzo_init.c
vendored
104
extern/lzo/src/lzo_init.c
vendored
@@ -48,14 +48,14 @@
|
||||
#undef LZOCHK_ASSERT
|
||||
#include "lzo_supp.h"
|
||||
|
||||
LZOCHK_ASSERT((LZO_UINT32_C(1) << (int)(8*sizeof(LZO_UINT32_C(1))-1)) > 0)
|
||||
LZOCHK_ASSERT_IS_SIGNED_T(lzo_int)
|
||||
LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint)
|
||||
LZOCHK_ASSERT((LZO_UINT32_C(1) << (int)(8 * sizeof(LZO_UINT32_C(1)) - 1)) > 0)
|
||||
LZOCHK_ASSERT_IS_SIGNED_T(lzo_int)
|
||||
LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint)
|
||||
#if !(__LZO_UINTPTR_T_IS_POINTER)
|
||||
LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t)
|
||||
LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t)
|
||||
#endif
|
||||
LZOCHK_ASSERT(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp))
|
||||
LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_xint)
|
||||
LZOCHK_ASSERT(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp))
|
||||
LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_xint)
|
||||
|
||||
#endif
|
||||
#undef LZOCHK_ASSERT
|
||||
@@ -65,9 +65,10 @@
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
union lzo_config_check_union {
|
||||
union lzo_config_check_union
|
||||
{
|
||||
lzo_uint a[2];
|
||||
unsigned char b[2*LZO_MAX(8,sizeof(lzo_uint))];
|
||||
unsigned char b[2 * LZO_MAX(8, sizeof(lzo_uint))];
|
||||
#if defined(lzo_uint64_t)
|
||||
lzo_uint64_t c[2];
|
||||
#endif
|
||||
@@ -79,7 +80,7 @@ union lzo_config_check_union {
|
||||
#else
|
||||
static __lzo_noinline lzo_voidp u2p(lzo_voidp ptr, lzo_uint off)
|
||||
{
|
||||
return (lzo_voidp) ((lzo_bytep) ptr + off);
|
||||
return (lzo_voidp)((lzo_bytep) ptr + off);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -102,17 +103,20 @@ _lzo_config_check(void)
|
||||
r &= ((* (lzo_bytep) p) == 0);
|
||||
#if !(LZO_CFG_NO_CONFIG_CHECK)
|
||||
#if (LZO_ABI_BIG_ENDIAN)
|
||||
u.a[0] = u.a[1] = 0; u.b[sizeof(lzo_uint) - 1] = 128;
|
||||
u.a[0] = u.a[1] = 0;
|
||||
u.b[sizeof(lzo_uint) - 1] = 128;
|
||||
p = u2p(&u, 0);
|
||||
r &= ((* (lzo_uintp) p) == 128);
|
||||
#endif
|
||||
#if (LZO_ABI_LITTLE_ENDIAN)
|
||||
u.a[0] = u.a[1] = 0; u.b[0] = 128;
|
||||
u.a[0] = u.a[1] = 0;
|
||||
u.b[0] = 128;
|
||||
p = u2p(&u, 0);
|
||||
r &= ((* (lzo_uintp) p) == 128);
|
||||
#endif
|
||||
u.a[0] = u.a[1] = 0;
|
||||
u.b[0] = 1; u.b[3] = 2;
|
||||
u.b[0] = 1;
|
||||
u.b[3] = 2;
|
||||
p = u2p(&u, 1);
|
||||
r &= UA_GET_NE16(p) == 0;
|
||||
r &= UA_GET_LE16(p) == 0;
|
||||
@@ -127,13 +131,16 @@ _lzo_config_check(void)
|
||||
r &= UA_GET_NE16(p) == LZO_UINT16_C(0x8180);
|
||||
#endif
|
||||
u.a[0] = u.a[1] = 0;
|
||||
u.b[0] = 3; u.b[5] = 4;
|
||||
u.b[0] = 3;
|
||||
u.b[5] = 4;
|
||||
p = u2p(&u, 1);
|
||||
r &= UA_GET_NE32(p) == 0;
|
||||
r &= UA_GET_LE32(p) == 0;
|
||||
u.b[1] = 128;
|
||||
r &= UA_GET_LE32(p) == 128;
|
||||
u.b[2] = 129; u.b[3] = 130; u.b[4] = 131;
|
||||
u.b[2] = 129;
|
||||
u.b[3] = 130;
|
||||
u.b[4] = 131;
|
||||
r &= UA_GET_LE32(p) == LZO_UINT32_C(0x83828180);
|
||||
#if (LZO_ABI_BIG_ENDIAN)
|
||||
r &= UA_GET_NE32(p) == LZO_UINT32_C(0x80818283);
|
||||
@@ -143,7 +150,8 @@ _lzo_config_check(void)
|
||||
#endif
|
||||
#if defined(UA_GET_NE64)
|
||||
u.c[0] = u.c[1] = 0;
|
||||
u.b[0] = 5; u.b[9] = 6;
|
||||
u.b[0] = 5;
|
||||
u.b[9] = 6;
|
||||
p = u2p(&u, 1);
|
||||
u.c[0] = u.c[1] = 0;
|
||||
r &= UA_GET_NE64(p) == 0;
|
||||
@@ -154,32 +162,52 @@ _lzo_config_check(void)
|
||||
#endif
|
||||
#endif
|
||||
#if defined(lzo_bitops_ctlz32)
|
||||
{ unsigned i = 0; lzo_uint32_t v;
|
||||
for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
|
||||
r &= lzo_bitops_ctlz32(v) == 31 - i;
|
||||
r &= lzo_bitops_ctlz32_func(v) == 31 - i;
|
||||
}}
|
||||
{
|
||||
unsigned i = 0;
|
||||
lzo_uint32_t v;
|
||||
|
||||
for (v = 1; v != 0 && r == 1; v <<= 1, i++)
|
||||
{
|
||||
r &= lzo_bitops_ctlz32(v) == 31 - i;
|
||||
r &= lzo_bitops_ctlz32_func(v) == 31 - i;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(lzo_bitops_ctlz64)
|
||||
{ unsigned i = 0; lzo_uint64_t v;
|
||||
for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
|
||||
r &= lzo_bitops_ctlz64(v) == 63 - i;
|
||||
r &= lzo_bitops_ctlz64_func(v) == 63 - i;
|
||||
}}
|
||||
{
|
||||
unsigned i = 0;
|
||||
lzo_uint64_t v;
|
||||
|
||||
for (v = 1; v != 0 && r == 1; v <<= 1, i++)
|
||||
{
|
||||
r &= lzo_bitops_ctlz64(v) == 63 - i;
|
||||
r &= lzo_bitops_ctlz64_func(v) == 63 - i;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(lzo_bitops_cttz32)
|
||||
{ unsigned i = 0; lzo_uint32_t v;
|
||||
for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
|
||||
r &= lzo_bitops_cttz32(v) == i;
|
||||
r &= lzo_bitops_cttz32_func(v) == i;
|
||||
}}
|
||||
{
|
||||
unsigned i = 0;
|
||||
lzo_uint32_t v;
|
||||
|
||||
for (v = 1; v != 0 && r == 1; v <<= 1, i++)
|
||||
{
|
||||
r &= lzo_bitops_cttz32(v) == i;
|
||||
r &= lzo_bitops_cttz32_func(v) == i;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(lzo_bitops_cttz64)
|
||||
{ unsigned i = 0; lzo_uint64_t v;
|
||||
for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
|
||||
r &= lzo_bitops_cttz64(v) == i;
|
||||
r &= lzo_bitops_cttz64_func(v) == i;
|
||||
}}
|
||||
{
|
||||
unsigned i = 0;
|
||||
lzo_uint64_t v;
|
||||
|
||||
for (v = 1; v != 0 && r == 1; v <<= 1, i++)
|
||||
{
|
||||
r &= lzo_bitops_cttz64(v) == i;
|
||||
r &= lzo_bitops_cttz64_func(v) == i;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
LZO_UNUSED_FUNC(lzo_bitops_unused_funcs);
|
||||
@@ -194,7 +222,7 @@ _lzo_config_check(void)
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
__lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5,
|
||||
int s6, int s7, int s8, int s9)
|
||||
int s6, int s7, int s8, int s9)
|
||||
{
|
||||
int r;
|
||||
|
||||
@@ -217,13 +245,15 @@ __lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5,
|
||||
(s4 == -1 || s4 == (int) sizeof(lzo_uint32_t)) &&
|
||||
(s5 == -1 || s5 == (int) sizeof(lzo_uint)) &&
|
||||
(s6 == -1 || s6 == (int) lzo_sizeof_dict_t) &&
|
||||
(s7 == -1 || s7 == (int) sizeof(char *)) &&
|
||||
(s7 == -1 || s7 == (int) sizeof(char*)) &&
|
||||
(s8 == -1 || s8 == (int) sizeof(lzo_voidp)) &&
|
||||
(s9 == -1 || s9 == (int) sizeof(lzo_callback_t));
|
||||
|
||||
if (!r)
|
||||
return LZO_E_ERROR;
|
||||
|
||||
r = _lzo_config_check();
|
||||
|
||||
if (r != LZO_E_OK)
|
||||
return r;
|
||||
|
||||
|
||||
28
extern/lzo/src/lzo_mchw.ch
vendored
28
extern/lzo/src/lzo_mchw.ch
vendored
@@ -110,9 +110,9 @@ LZO_COMPRESS_T;
|
||||
************************************************************************/
|
||||
|
||||
static int
|
||||
init_match ( LZO_COMPRESS_T *c, lzo_swd_p s,
|
||||
const lzo_bytep dict, lzo_uint dict_len,
|
||||
lzo_uint32_t flags )
|
||||
init_match(LZO_COMPRESS_T* c, lzo_swd_p s,
|
||||
const lzo_bytep dict, lzo_uint dict_len,
|
||||
lzo_uint32_t flags)
|
||||
{
|
||||
int r;
|
||||
|
||||
@@ -127,7 +127,8 @@ init_match ( LZO_COMPRESS_T *c, lzo_swd_p s,
|
||||
c->lit_bytes = c->match_bytes = c->rep_bytes = 0;
|
||||
c->lazy = 0;
|
||||
|
||||
r = swd_init(s,dict,dict_len);
|
||||
r = swd_init(s, dict, dict_len);
|
||||
|
||||
if (r != LZO_E_OK)
|
||||
{
|
||||
swd_exit(s);
|
||||
@@ -144,8 +145,8 @@ init_match ( LZO_COMPRESS_T *c, lzo_swd_p s,
|
||||
************************************************************************/
|
||||
|
||||
static int
|
||||
find_match ( LZO_COMPRESS_T *c, lzo_swd_p s,
|
||||
lzo_uint this_len, lzo_uint skip )
|
||||
find_match(LZO_COMPRESS_T* c, lzo_swd_p s,
|
||||
lzo_uint this_len, lzo_uint skip)
|
||||
{
|
||||
assert(c->init);
|
||||
|
||||
@@ -164,8 +165,10 @@ find_match ( LZO_COMPRESS_T *c, lzo_swd_p s,
|
||||
s->m_len = SWD_THRESHOLD;
|
||||
s->m_off = 0;
|
||||
#ifdef SWD_BEST_OFF
|
||||
|
||||
if (s->use_best_off)
|
||||
lzo_memset(s->best_pos,0,sizeof(s->best_pos));
|
||||
lzo_memset(s->best_pos, 0, sizeof(s->best_pos));
|
||||
|
||||
#endif
|
||||
swd_findbest(s);
|
||||
c->m_len = s->m_len;
|
||||
@@ -183,9 +186,11 @@ find_match ( LZO_COMPRESS_T *c, lzo_swd_p s,
|
||||
{
|
||||
c->look = s->look + 1;
|
||||
}
|
||||
|
||||
c->bp = c->ip - c->look;
|
||||
|
||||
#if 0
|
||||
|
||||
/* brute force match search */
|
||||
if (c->m_len > SWD_THRESHOLD && c->m_len + 1 <= c->look)
|
||||
{
|
||||
@@ -195,18 +200,23 @@ find_match ( LZO_COMPRESS_T *c, lzo_swd_p s,
|
||||
|
||||
if (ip - in > s->swd_n)
|
||||
in = ip - s->swd_n;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
while (*in != *ip)
|
||||
in++;
|
||||
|
||||
if (in == ip)
|
||||
break;
|
||||
|
||||
if (in != m)
|
||||
if (lzo_memcmp(in,ip,c->m_len+1) == 0)
|
||||
printf("%p %p %p %5d\n",in,ip,m,c->m_len);
|
||||
if (lzo_memcmp(in, ip, c->m_len + 1) == 0)
|
||||
printf("%p %p %p %5d\n", in, ip, m, c->m_len);
|
||||
|
||||
in++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (c->cb && c->cb->nprogress && c->textsize > c->printcount)
|
||||
|
||||
7
extern/lzo/src/lzo_ptr.c
vendored
7
extern/lzo/src/lzo_ptr.c
vendored
@@ -61,14 +61,19 @@ __lzo_align_gap(const lzo_voidp ptr, lzo_uint size)
|
||||
#error "__LZO_UINTPTR_T_IS_POINTER is unsupported"
|
||||
#else
|
||||
lzo_uintptr_t p, n;
|
||||
|
||||
if (size < 2) return 0;
|
||||
|
||||
p = __lzo_ptr_linear(ptr);
|
||||
#if 0
|
||||
n = (((p + size - 1) / size) * size) - p;
|
||||
#else
|
||||
|
||||
if ((size & (size - 1)) != 0)
|
||||
return 0;
|
||||
n = size; n = ((p + n - 1) & ~(n - 1)) - p;
|
||||
|
||||
n = size;
|
||||
n = ((p + n - 1) & ~(n - 1)) - p;
|
||||
#endif
|
||||
#endif
|
||||
assert((long)n >= 0);
|
||||
|
||||
12
extern/lzo/src/lzo_ptr.h
vendored
12
extern/lzo/src/lzo_ptr.h
vendored
@@ -98,12 +98,12 @@ typedef union
|
||||
size_t a_size_t;
|
||||
ptrdiff_t a_ptrdiff_t;
|
||||
lzo_uintptr_t a_lzo_uintptr_t;
|
||||
void * a_void_p;
|
||||
char * a_char_p;
|
||||
unsigned char * a_uchar_p;
|
||||
const void * a_c_void_p;
|
||||
const char * a_c_char_p;
|
||||
const unsigned char * a_c_uchar_p;
|
||||
void* a_void_p;
|
||||
char* a_char_p;
|
||||
unsigned char* a_uchar_p;
|
||||
const void* a_c_void_p;
|
||||
const char* a_c_char_p;
|
||||
const unsigned char* a_c_uchar_p;
|
||||
lzo_voidp a_lzo_voidp;
|
||||
lzo_bytep a_lzo_bytep;
|
||||
const lzo_voidp a_c_lzo_voidp;
|
||||
|
||||
1874
extern/lzo/src/lzo_supp.h
vendored
1874
extern/lzo/src/lzo_supp.h
vendored
File diff suppressed because it is too large
Load Diff
263
extern/lzo/src/lzo_swd.ch
vendored
263
extern/lzo/src/lzo_swd.ch
vendored
@@ -43,10 +43,10 @@
|
||||
|
||||
/* unsigned type for dictionary access - don't waste memory here */
|
||||
#if (0UL + SWD_N + SWD_F + SWD_F < 65535UL)
|
||||
typedef lzo_uint16_t swd_uint;
|
||||
typedef lzo_uint16_t swd_uint;
|
||||
# define SWD_UINT_MAX 0xffffu
|
||||
#else
|
||||
typedef lzo_uint32_t swd_uint;
|
||||
typedef lzo_uint32_t swd_uint;
|
||||
# define SWD_UINT_MAX 0xffffffffu
|
||||
#endif
|
||||
#define swd_uintp swd_uint *
|
||||
@@ -85,18 +85,18 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* public - "built-in" */
|
||||
/* public - "built-in" */
|
||||
lzo_uint swd_n;
|
||||
lzo_uint swd_f;
|
||||
lzo_uint swd_threshold;
|
||||
|
||||
/* public - configuration */
|
||||
/* public - configuration */
|
||||
lzo_uint max_chain;
|
||||
lzo_uint nice_length;
|
||||
lzo_bool use_best_off;
|
||||
lzo_uint lazy_insert;
|
||||
|
||||
/* public - output */
|
||||
/* public - output */
|
||||
lzo_uint m_len;
|
||||
lzo_uint m_off;
|
||||
lzo_uint look;
|
||||
@@ -105,19 +105,19 @@ typedef struct
|
||||
lzo_uint best_off[ SWD_BEST_OFF ];
|
||||
#endif
|
||||
|
||||
/* semi public */
|
||||
LZO_COMPRESS_T *c;
|
||||
/* semi public */
|
||||
LZO_COMPRESS_T* c;
|
||||
lzo_uint m_pos;
|
||||
#if defined(SWD_BEST_OFF)
|
||||
lzo_uint best_pos[ SWD_BEST_OFF ];
|
||||
#endif
|
||||
|
||||
/* private */
|
||||
/* private */
|
||||
const lzo_bytep dict;
|
||||
const lzo_bytep dict_end;
|
||||
lzo_uint dict_len;
|
||||
|
||||
/* private */
|
||||
/* private */
|
||||
lzo_uint ip; /* input pointer (lookahead) */
|
||||
lzo_uint bp; /* buffer pointer */
|
||||
lzo_uint rp; /* remove pointer */
|
||||
@@ -130,13 +130,13 @@ typedef struct
|
||||
|
||||
#if defined(__LZO_CHECKER)
|
||||
/* malloc arrays of the exact size to detect any overrun */
|
||||
unsigned char *b;
|
||||
swd_uint *head3;
|
||||
swd_uint *succ3;
|
||||
swd_uint *best3;
|
||||
swd_uint *llen3;
|
||||
unsigned char* b;
|
||||
swd_uint* head3;
|
||||
swd_uint* succ3;
|
||||
swd_uint* best3;
|
||||
swd_uint* llen3;
|
||||
# ifdef HEAD2
|
||||
swd_uint *head2;
|
||||
swd_uint* head2;
|
||||
# endif
|
||||
|
||||
#else
|
||||
@@ -189,6 +189,7 @@ void swd_initdict(lzo_swd_p s, const lzo_bytep dict, lzo_uint dict_len)
|
||||
|
||||
if (!dict || dict_len == 0)
|
||||
return;
|
||||
|
||||
if (dict_len > s->swd_n)
|
||||
{
|
||||
dict += dict_len - s->swd_n;
|
||||
@@ -198,7 +199,7 @@ void swd_initdict(lzo_swd_p s, const lzo_bytep dict, lzo_uint dict_len)
|
||||
s->dict = dict;
|
||||
s->dict_len = dict_len;
|
||||
s->dict_end = dict + dict_len;
|
||||
lzo_memcpy(s_b(s),dict,dict_len);
|
||||
lzo_memcpy(s_b(s), dict, dict_len);
|
||||
s->ip = dict_len;
|
||||
}
|
||||
|
||||
@@ -212,24 +213,25 @@ void swd_insertdict(lzo_swd_p s, lzo_uint node, lzo_uint len)
|
||||
s->first_rp = node;
|
||||
|
||||
if (len) do
|
||||
{
|
||||
key = HEAD3(s_b(s),node);
|
||||
s_succ3(s)[node] = s_get_head3(s,key);
|
||||
s_head3(s)[key] = SWD_UINT(node);
|
||||
s_best3(s)[node] = SWD_UINT(s->swd_f + 1);
|
||||
s_llen3(s)[key]++;
|
||||
assert(s_llen3(s)[key] <= s->swd_n);
|
||||
{
|
||||
key = HEAD3(s_b(s), node);
|
||||
s_succ3(s)[node] = s_get_head3(s, key);
|
||||
s_head3(s)[key] = SWD_UINT(node);
|
||||
s_best3(s)[node] = SWD_UINT(s->swd_f + 1);
|
||||
s_llen3(s)[key]++;
|
||||
assert(s_llen3(s)[key] <= s->swd_n);
|
||||
|
||||
#ifdef HEAD2
|
||||
IF_HEAD2(s) {
|
||||
key = HEAD2(s_b(s),node);
|
||||
s_head2(s)[key] = SWD_UINT(node);
|
||||
}
|
||||
IF_HEAD2(s)
|
||||
{
|
||||
key = HEAD2(s_b(s), node);
|
||||
s_head2(s)[key] = SWD_UINT(node);
|
||||
}
|
||||
#endif
|
||||
|
||||
node++;
|
||||
}
|
||||
while (--len != 0);
|
||||
node++;
|
||||
}
|
||||
while (--len != 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -255,15 +257,19 @@ int swd_init(lzo_swd_p s, const lzo_bytep dict, lzo_uint dict_len)
|
||||
r &= s->best3 != NULL;
|
||||
r &= s->llen3 != NULL;
|
||||
#ifdef HEAD2
|
||||
IF_HEAD2(s) {
|
||||
IF_HEAD2(s)
|
||||
{
|
||||
s->head2 = (swd_uintp) malloc(sizeof(swd_uint) * 65536L);
|
||||
r &= s->head2 != NULL;
|
||||
}
|
||||
#endif
|
||||
if (r != 1) {
|
||||
|
||||
if (r != 1)
|
||||
{
|
||||
swd_exit(s);
|
||||
return LZO_E_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
s->m_len = 0;
|
||||
@@ -271,6 +277,7 @@ int swd_init(lzo_swd_p s, const lzo_bytep dict, lzo_uint dict_len)
|
||||
#if defined(SWD_BEST_OFF)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < SWD_BEST_OFF; i++)
|
||||
s->best_off[i] = s->best_pos[i] = 0;
|
||||
}
|
||||
@@ -288,8 +295,10 @@ int swd_init(lzo_swd_p s, const lzo_bytep dict, lzo_uint dict_len)
|
||||
|
||||
s->b_size = s->swd_n + s->swd_f;
|
||||
#if 0
|
||||
|
||||
if (2 * s->swd_f >= s->swd_n || s->b_size + s->swd_f >= SWD_UINT_MAX)
|
||||
return LZO_E_ERROR;
|
||||
|
||||
#else
|
||||
LZO_COMPILE_TIME_ASSERT(!(0ul + 2 * SWD_F >= SWD_N))
|
||||
LZO_COMPILE_TIME_ASSERT(!(0ul + SWD_N + SWD_F + SWD_F >= SWD_UINT_MAX))
|
||||
@@ -299,65 +308,80 @@ int swd_init(lzo_swd_p s, const lzo_bytep dict, lzo_uint dict_len)
|
||||
|
||||
lzo_memset(s_llen3(s), 0, (lzo_uint)sizeof(s_llen3(s)[0]) * (lzo_uint)SWD_HSIZE);
|
||||
#ifdef HEAD2
|
||||
IF_HEAD2(s) {
|
||||
IF_HEAD2(s)
|
||||
{
|
||||
#if 1
|
||||
lzo_memset(s_head2(s), 0xff, (lzo_uint)sizeof(s_head2(s)[0]) * 65536L);
|
||||
assert(s_head2(s)[0] == NIL2);
|
||||
#else
|
||||
lzo_xint i;
|
||||
|
||||
for (i = 0; i < 65536L; i++)
|
||||
s_head2(s)[i] = NIL2;
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
s->ip = 0;
|
||||
swd_initdict(s,dict,dict_len);
|
||||
swd_initdict(s, dict, dict_len);
|
||||
s->bp = s->ip;
|
||||
s->first_rp = s->ip;
|
||||
|
||||
assert(s->ip + s->swd_f <= s->b_size);
|
||||
#if 1
|
||||
s->look = (lzo_uint) (s->c->in_end - s->c->ip);
|
||||
s->look = (lzo_uint)(s->c->in_end - s->c->ip);
|
||||
|
||||
if (s->look > 0)
|
||||
{
|
||||
if (s->look > s->swd_f)
|
||||
s->look = s->swd_f;
|
||||
lzo_memcpy(&s_b(s)[s->ip],s->c->ip,s->look);
|
||||
|
||||
lzo_memcpy(&s_b(s)[s->ip], s->c->ip, s->look);
|
||||
s->c->ip += s->look;
|
||||
s->ip += s->look;
|
||||
}
|
||||
|
||||
#else
|
||||
s->look = 0;
|
||||
|
||||
while (s->look < s->swd_f)
|
||||
{
|
||||
int c;
|
||||
|
||||
if ((c = getbyte(*(s->c))) < 0)
|
||||
break;
|
||||
|
||||
s_b(s)[s->ip] = LZO_BYTE(c);
|
||||
s->ip++;
|
||||
s->look++;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (s->ip == s->b_size)
|
||||
s->ip = 0;
|
||||
|
||||
if (s->look >= 2 && s->dict_len > 0)
|
||||
swd_insertdict(s,0,s->dict_len);
|
||||
swd_insertdict(s, 0, s->dict_len);
|
||||
|
||||
s->rp = s->first_rp;
|
||||
|
||||
if (s->rp >= s->node_count)
|
||||
s->rp -= s->node_count;
|
||||
else
|
||||
s->rp += s->b_size - s->node_count;
|
||||
|
||||
#if 1 || defined(__LZO_CHECKER)
|
||||
|
||||
/* initialize memory for the first few HEAD3 (if s->ip is not far
|
||||
* enough ahead to do this job for us). The value doesn't matter. */
|
||||
if (s->look < 3) {
|
||||
lzo_bytep p = &s_b(s)[s->bp+s->look];
|
||||
if (s->look < 3)
|
||||
{
|
||||
lzo_bytep p = &s_b(s)[s->bp + s->look];
|
||||
p[0] = p[1] = p[2] = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return LZO_E_OK;
|
||||
@@ -370,13 +394,19 @@ void swd_exit(lzo_swd_p s)
|
||||
#if defined(__LZO_CHECKER)
|
||||
/* free in reverse order of allocations */
|
||||
#ifdef HEAD2
|
||||
free(s->head2); s->head2 = NULL;
|
||||
free(s->head2);
|
||||
s->head2 = NULL;
|
||||
#endif
|
||||
free(s->llen3); s->llen3 = NULL;
|
||||
free(s->best3); s->best3 = NULL;
|
||||
free(s->succ3); s->succ3 = NULL;
|
||||
free(s->head3); s->head3 = NULL;
|
||||
free(s->b); s->b = NULL;
|
||||
free(s->llen3);
|
||||
s->llen3 = NULL;
|
||||
free(s->best3);
|
||||
s->best3 = NULL;
|
||||
free(s->succ3);
|
||||
s->succ3 = NULL;
|
||||
free(s->head3);
|
||||
s->head3 = NULL;
|
||||
free(s->b);
|
||||
s->b = NULL;
|
||||
#else
|
||||
LZO_UNUSED(s);
|
||||
#endif
|
||||
@@ -400,23 +430,30 @@ void swd_getbyte(lzo_swd_p s)
|
||||
{
|
||||
if (s->look > 0)
|
||||
--s->look;
|
||||
|
||||
#if 1 || defined(__LZO_CHECKER)
|
||||
/* initialize memory - value doesn't matter */
|
||||
s_b(s)[s->ip] = 0;
|
||||
|
||||
if (s->ip < s->swd_f)
|
||||
s->b_wrap[s->ip] = 0;
|
||||
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
s_b(s)[s->ip] = LZO_BYTE(c);
|
||||
|
||||
if (s->ip < s->swd_f)
|
||||
s->b_wrap[s->ip] = LZO_BYTE(c);
|
||||
}
|
||||
|
||||
if (++s->ip == s->b_size)
|
||||
s->ip = 0;
|
||||
|
||||
if (++s->bp == s->b_size)
|
||||
s->bp = 0;
|
||||
|
||||
if (++s->rp == s->b_size)
|
||||
s->rp = 0;
|
||||
}
|
||||
@@ -434,26 +471,31 @@ void swd_remove_node(lzo_swd_p s, lzo_uint node)
|
||||
lzo_uint key;
|
||||
|
||||
#ifdef LZO_DEBUG
|
||||
|
||||
if (s->first_rp != LZO_UINT_MAX)
|
||||
{
|
||||
if (node != s->first_rp)
|
||||
printf("Remove %5ld: %5ld %5ld %5ld %5ld %6ld %6ld\n",
|
||||
(long)node, (long)s->rp, (long)s->ip, (long)s->bp,
|
||||
(long)s->first_rp, (long)(s->ip - node),
|
||||
(long)(s->ip - s->bp));
|
||||
(long)node, (long)s->rp, (long)s->ip, (long)s->bp,
|
||||
(long)s->first_rp, (long)(s->ip - node),
|
||||
(long)(s->ip - s->bp));
|
||||
|
||||
assert(node == s->first_rp);
|
||||
s->first_rp = LZO_UINT_MAX;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
key = HEAD3(s_b(s),node);
|
||||
key = HEAD3(s_b(s), node);
|
||||
assert(s_llen3(s)[key] > 0);
|
||||
--s_llen3(s)[key];
|
||||
|
||||
#ifdef HEAD2
|
||||
IF_HEAD2(s) {
|
||||
key = HEAD2(s_b(s),node);
|
||||
IF_HEAD2(s)
|
||||
{
|
||||
key = HEAD2(s_b(s), node);
|
||||
assert(s_head2(s)[key] != NIL2);
|
||||
|
||||
if ((lzo_uint) s_head2(s)[key] == node)
|
||||
s_head2(s)[key] = NIL2;
|
||||
}
|
||||
@@ -474,29 +516,31 @@ void swd_accept(lzo_swd_p s, lzo_uint n)
|
||||
assert(n <= s->look);
|
||||
|
||||
if (n) do
|
||||
{
|
||||
lzo_uint key;
|
||||
{
|
||||
lzo_uint key;
|
||||
|
||||
swd_remove_node(s,s->rp);
|
||||
swd_remove_node(s, s->rp);
|
||||
|
||||
/* add bp into HEAD3 */
|
||||
key = HEAD3(s_b(s),s->bp);
|
||||
s_succ3(s)[s->bp] = s_get_head3(s,key);
|
||||
s_head3(s)[key] = SWD_UINT(s->bp);
|
||||
s_best3(s)[s->bp] = SWD_UINT(s->swd_f + 1);
|
||||
s_llen3(s)[key]++;
|
||||
assert(s_llen3(s)[key] <= s->swd_n);
|
||||
/* add bp into HEAD3 */
|
||||
key = HEAD3(s_b(s), s->bp);
|
||||
s_succ3(s)[s->bp] = s_get_head3(s, key);
|
||||
s_head3(s)[key] = SWD_UINT(s->bp);
|
||||
s_best3(s)[s->bp] = SWD_UINT(s->swd_f + 1);
|
||||
s_llen3(s)[key]++;
|
||||
assert(s_llen3(s)[key] <= s->swd_n);
|
||||
|
||||
#ifdef HEAD2
|
||||
/* add bp into HEAD2 */
|
||||
IF_HEAD2(s) {
|
||||
key = HEAD2(s_b(s),s->bp);
|
||||
s_head2(s)[key] = SWD_UINT(s->bp);
|
||||
}
|
||||
/* add bp into HEAD2 */
|
||||
IF_HEAD2(s)
|
||||
{
|
||||
key = HEAD2(s_b(s), s->bp);
|
||||
s_head2(s)[key] = SWD_UINT(s->bp);
|
||||
}
|
||||
#endif
|
||||
|
||||
swd_getbyte(s);
|
||||
} while (--n != 0);
|
||||
swd_getbyte(s);
|
||||
}
|
||||
while (--n != 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -519,7 +563,8 @@ void swd_search(lzo_swd_p s, lzo_uint node, lzo_uint cnt)
|
||||
assert(s->m_len > 0);
|
||||
|
||||
scan_end1 = bp[m_len - 1];
|
||||
for ( ; cnt-- > 0; node = s_succ3(s)[node])
|
||||
|
||||
for (; cnt-- > 0; node = s_succ3(s)[node])
|
||||
{
|
||||
p1 = bp;
|
||||
p2 = b + node;
|
||||
@@ -536,45 +581,62 @@ void swd_search(lzo_swd_p s, lzo_uint node, lzo_uint cnt)
|
||||
p2[1] == p1[1])
|
||||
{
|
||||
lzo_uint i;
|
||||
assert(lzo_memcmp(bp,&b[node],3) == 0);
|
||||
assert(lzo_memcmp(bp, &b[node], 3) == 0);
|
||||
|
||||
#if 0 && (LZO_OPT_UNALIGNED32)
|
||||
p1 += 3; p2 += 3;
|
||||
p1 += 3;
|
||||
p2 += 3;
|
||||
|
||||
while (p1 + 4 <= px && UA_GET_NE32(p1) == UA_GET_NE32(p2))
|
||||
p1 += 4, p2 += 4;
|
||||
|
||||
while (p1 < px && *p1 == *p2)
|
||||
p1 += 1, p2 += 1;
|
||||
|
||||
#else
|
||||
p1 += 2; p2 += 2;
|
||||
do {} while (++p1 < px && *p1 == *++p2);
|
||||
p1 += 2;
|
||||
p2 += 2;
|
||||
|
||||
do {}
|
||||
while (++p1 < px && *p1 == *++p2);
|
||||
|
||||
#endif
|
||||
i = pd(p1, bp);
|
||||
|
||||
#ifdef LZO_DEBUG
|
||||
if (lzo_memcmp(bp,&b[node],i) != 0)
|
||||
|
||||
if (lzo_memcmp(bp, &b[node], i) != 0)
|
||||
printf("%5ld %5ld %5ld %02x/%02x %02x/%02x\n",
|
||||
(long)s->bp, (long) node, (long) i,
|
||||
bp[0], bp[1], b[node], b[node+1]);
|
||||
(long)s->bp, (long) node, (long) i,
|
||||
bp[0], bp[1], b[node], b[node + 1]);
|
||||
|
||||
#endif
|
||||
assert(lzo_memcmp(bp,&b[node],i) == 0);
|
||||
assert(lzo_memcmp(bp, &b[node], i) == 0);
|
||||
|
||||
#if defined(SWD_BEST_OFF)
|
||||
|
||||
if (i < SWD_BEST_OFF)
|
||||
{
|
||||
if (s->best_pos[i] == 0)
|
||||
s->best_pos[i] = node + 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (i > m_len)
|
||||
{
|
||||
s->m_len = m_len = i;
|
||||
s->m_pos = node;
|
||||
|
||||
if (m_len == s->look)
|
||||
return;
|
||||
|
||||
if (m_len >= s->nice_length)
|
||||
return;
|
||||
|
||||
if (m_len > (lzo_uint) s_best3(s)[node])
|
||||
return;
|
||||
|
||||
scan_end1 = bp[m_len - 1];
|
||||
}
|
||||
}
|
||||
@@ -596,18 +658,24 @@ lzo_bool swd_search2(lzo_swd_p s)
|
||||
assert(s->look >= 2);
|
||||
assert(s->m_len > 0);
|
||||
|
||||
key = s_head2(s)[ HEAD2(s_b(s),s->bp) ];
|
||||
key = s_head2(s)[ HEAD2(s_b(s), s->bp) ];
|
||||
|
||||
if (key == NIL2)
|
||||
return 0;
|
||||
|
||||
#ifdef LZO_DEBUG
|
||||
if (lzo_memcmp(&s_b(s)[s->bp],&s_b(s)[key],2) != 0)
|
||||
|
||||
if (lzo_memcmp(&s_b(s)[s->bp], &s_b(s)[key], 2) != 0)
|
||||
printf("%5ld %5ld %02x/%02x %02x/%02x\n", (long)s->bp, (long)key,
|
||||
s_b(s)[s->bp], s_b(s)[s->bp+1], s_b(s)[key], s_b(s)[key+1]);
|
||||
s_b(s)[s->bp], s_b(s)[s->bp + 1], s_b(s)[key], s_b(s)[key + 1]);
|
||||
|
||||
#endif
|
||||
assert(lzo_memcmp(&s_b(s)[s->bp],&s_b(s)[key],2) == 0);
|
||||
assert(lzo_memcmp(&s_b(s)[s->bp], &s_b(s)[key], 2) == 0);
|
||||
#if defined(SWD_BEST_OFF)
|
||||
|
||||
if (s->best_pos[2] == 0)
|
||||
s->best_pos[2] = key + 1;
|
||||
|
||||
#endif
|
||||
|
||||
if (s->m_len < 2)
|
||||
@@ -615,6 +683,7 @@ lzo_bool swd_search2(lzo_swd_p s)
|
||||
s->m_len = 2;
|
||||
s->m_pos = key;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -635,55 +704,69 @@ void swd_findbest(lzo_swd_p s)
|
||||
assert(s->m_len > 0);
|
||||
|
||||
/* get current head, add bp into HEAD3 */
|
||||
key = HEAD3(s_b(s),s->bp);
|
||||
node = s_succ3(s)[s->bp] = s_get_head3(s,key);
|
||||
key = HEAD3(s_b(s), s->bp);
|
||||
node = s_succ3(s)[s->bp] = s_get_head3(s, key);
|
||||
cnt = s_llen3(s)[key]++;
|
||||
assert(s_llen3(s)[key] <= s->swd_n + s->swd_f);
|
||||
|
||||
if (cnt > s->max_chain && s->max_chain > 0)
|
||||
cnt = s->max_chain;
|
||||
|
||||
s_head3(s)[key] = SWD_UINT(s->bp);
|
||||
|
||||
s->b_char = s_b(s)[s->bp];
|
||||
len = s->m_len;
|
||||
|
||||
if (s->m_len >= s->look)
|
||||
{
|
||||
if (s->look == 0)
|
||||
s->b_char = -1;
|
||||
|
||||
s->m_off = 0;
|
||||
s_best3(s)[s->bp] = SWD_UINT(s->swd_f + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(HEAD2)
|
||||
|
||||
if (swd_search2(s) && s->look >= 3)
|
||||
swd_search(s,node,cnt);
|
||||
swd_search(s, node, cnt);
|
||||
|
||||
#else
|
||||
|
||||
if (s->look >= 3)
|
||||
swd_search(s,node,cnt);
|
||||
swd_search(s, node, cnt);
|
||||
|
||||
#endif
|
||||
|
||||
if (s->m_len > len)
|
||||
s->m_off = swd_pos2off(s,s->m_pos);
|
||||
s->m_off = swd_pos2off(s, s->m_pos);
|
||||
|
||||
s_best3(s)[s->bp] = SWD_UINT(s->m_len);
|
||||
|
||||
#if defined(SWD_BEST_OFF)
|
||||
|
||||
if (s->use_best_off)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 2; i < SWD_BEST_OFF; i++)
|
||||
if (s->best_pos[i] > 0)
|
||||
s->best_off[i] = swd_pos2off(s,s->best_pos[i]-1);
|
||||
s->best_off[i] = swd_pos2off(s, s->best_pos[i] - 1);
|
||||
else
|
||||
s->best_off[i] = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
swd_remove_node(s,s->rp);
|
||||
swd_remove_node(s, s->rp);
|
||||
|
||||
#ifdef HEAD2
|
||||
/* add bp into HEAD2 */
|
||||
IF_HEAD2(s) {
|
||||
key = HEAD2(s_b(s),s->bp);
|
||||
IF_HEAD2(s)
|
||||
{
|
||||
key = HEAD2(s_b(s), s->bp);
|
||||
s_head2(s)[key] = SWD_UINT(s->bp);
|
||||
}
|
||||
#endif
|
||||
|
||||
28
extern/lzo/src/lzo_util.c
vendored
28
extern/lzo/src/lzo_util.c
vendored
@@ -66,13 +66,13 @@ lzo_version(void)
|
||||
return LZO_VERSION;
|
||||
}
|
||||
|
||||
LZO_PUBLIC(const char *)
|
||||
LZO_PUBLIC(const char*)
|
||||
lzo_version_string(void)
|
||||
{
|
||||
return lzo_version_string_;
|
||||
}
|
||||
|
||||
LZO_PUBLIC(const char *)
|
||||
LZO_PUBLIC(const char*)
|
||||
lzo_version_date(void)
|
||||
{
|
||||
return lzo_version_date_;
|
||||
@@ -121,20 +121,26 @@ lzo_adler32(lzo_uint32_t adler, const lzo_bytep buf, lzo_uint len)
|
||||
{
|
||||
k = len < LZO_NMAX ? (unsigned) len : LZO_NMAX;
|
||||
len -= k;
|
||||
|
||||
if (k >= 16) do
|
||||
{
|
||||
LZO_DO16(buf,0);
|
||||
buf += 16;
|
||||
k -= 16;
|
||||
} while (k >= 16);
|
||||
{
|
||||
LZO_DO16(buf, 0);
|
||||
buf += 16;
|
||||
k -= 16;
|
||||
}
|
||||
while (k >= 16);
|
||||
|
||||
if (k != 0) do
|
||||
{
|
||||
s1 += *buf++;
|
||||
s2 += s1;
|
||||
} while (--k > 0);
|
||||
{
|
||||
s1 += *buf++;
|
||||
s2 += s1;
|
||||
}
|
||||
while (--k > 0);
|
||||
|
||||
s1 %= LZO_BASE;
|
||||
s2 %= LZO_BASE;
|
||||
}
|
||||
|
||||
return (s2 << 16) | s1;
|
||||
}
|
||||
|
||||
|
||||
19
extern/lzo/src/stats1a.h
vendored
19
extern/lzo/src/stats1a.h
vendored
@@ -57,17 +57,18 @@ extern "C" {
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
|
||||
/* configuration */
|
||||
/* configuration */
|
||||
unsigned rbits;
|
||||
unsigned clevel;
|
||||
|
||||
/* internal configuration */
|
||||
/* internal configuration */
|
||||
unsigned dbits;
|
||||
unsigned lbits;
|
||||
|
||||
/* constants */
|
||||
/* constants */
|
||||
unsigned min_match_short;
|
||||
unsigned max_match_short;
|
||||
unsigned min_match_long;
|
||||
@@ -78,7 +79,7 @@ typedef struct {
|
||||
unsigned r0fast;
|
||||
unsigned r0max;
|
||||
|
||||
/* counts */
|
||||
/* counts */
|
||||
long short_matches;
|
||||
long long_matches;
|
||||
long r1_matches;
|
||||
@@ -88,14 +89,14 @@ typedef struct {
|
||||
long r0fast_runs;
|
||||
long r0long_runs;
|
||||
|
||||
/* */
|
||||
/* */
|
||||
long lit_run[RSIZE];
|
||||
long lit_run_after_long_match[RSIZE];
|
||||
long short_match[MAX_MATCH_SHORT + 1];
|
||||
long long_match[MAX_MATCH_LONG + 1];
|
||||
long marker[256];
|
||||
|
||||
/* these could prove useful for further optimizations */
|
||||
/* these could prove useful for further optimizations */
|
||||
long short_match_offset_osize[MAX_MATCH_SHORT + 1];
|
||||
long short_match_offset_256[MAX_MATCH_SHORT + 1];
|
||||
long short_match_offset_1024[MAX_MATCH_SHORT + 1];
|
||||
@@ -104,13 +105,13 @@ typedef struct {
|
||||
long matches_out_of_range_4;
|
||||
long match_out_of_range[MAX_MATCH_SHORT + 1];
|
||||
|
||||
/* */
|
||||
/* */
|
||||
long in_len;
|
||||
long out_len;
|
||||
}
|
||||
lzo1a_stats_t;
|
||||
|
||||
extern lzo1a_stats_t *lzo1a_stats;
|
||||
extern lzo1a_stats_t* lzo1a_stats;
|
||||
|
||||
|
||||
|
||||
|
||||
24
extern/lzo/src/stats1b.h
vendored
24
extern/lzo/src/stats1b.h
vendored
@@ -57,19 +57,19 @@ extern "C" {
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* algorithm configuration */
|
||||
/* algorithm configuration */
|
||||
unsigned r_bits;
|
||||
unsigned m3o_bits;
|
||||
unsigned dd_bits;
|
||||
unsigned clevel;
|
||||
|
||||
/* internal configuration */
|
||||
/* internal configuration */
|
||||
unsigned d_bits;
|
||||
long min_lookahead;
|
||||
long max_lookbehind;
|
||||
const char *compress_id;
|
||||
const char* compress_id;
|
||||
|
||||
/* counts */
|
||||
/* counts */
|
||||
long lit_runs;
|
||||
long r0short_runs;
|
||||
long r0fast_runs;
|
||||
@@ -80,16 +80,16 @@ typedef struct
|
||||
long m4_matches;
|
||||
long r1_matches;
|
||||
|
||||
/* */
|
||||
/* */
|
||||
long lit_run[R0MIN];
|
||||
long m2_match[M2_MAX_LEN + 1];
|
||||
long m3_match[M3_MAX_LEN + 1];
|
||||
#if (M3O_BITS < 8)
|
||||
long lit_runs_after_m3_match;
|
||||
long lit_run_after_m3_match[LZO_SIZE(8-M3O_BITS)];
|
||||
long lit_run_after_m3_match[LZO_SIZE(8 - M3O_BITS)];
|
||||
#endif
|
||||
|
||||
/* */
|
||||
/* */
|
||||
long matches;
|
||||
long match_bytes;
|
||||
long literals;
|
||||
@@ -97,21 +97,21 @@ typedef struct
|
||||
long literal_bytes;
|
||||
double literal_overhead_percent;
|
||||
|
||||
/* */
|
||||
/* */
|
||||
long unused_dict_entries;
|
||||
double unused_dict_entries_percent;
|
||||
|
||||
/* */
|
||||
/* */
|
||||
long in_len;
|
||||
long out_len;
|
||||
}
|
||||
lzo1b_stats_t;
|
||||
|
||||
|
||||
void _lzo1b_stats_init(lzo1b_stats_t *lzo_stats);
|
||||
void _lzo1b_stats_calc(lzo1b_stats_t *lzo_stats);
|
||||
void _lzo1b_stats_init(lzo1b_stats_t* lzo_stats);
|
||||
void _lzo1b_stats_calc(lzo1b_stats_t* lzo_stats);
|
||||
|
||||
extern lzo1b_stats_t * const lzo1b_stats;
|
||||
extern lzo1b_stats_t* const lzo1b_stats;
|
||||
|
||||
#define lzo_stats_t lzo1b_stats_t
|
||||
#define lzo_stats lzo1b_stats
|
||||
|
||||
11
extern/yaml/CMakeLists.txt
vendored
Normal file
11
extern/yaml/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
set(YAML_VERSION_MAJOR 0)
|
||||
set(YAML_VERSION_MINOR 1)
|
||||
set(YAML_VERSION_PATCH 6)
|
||||
set(YAML_VERSION_STRING "${YAML_VERSION_MAJOR}.${YAML_VERSION_MINOR}.${YAML_VERSION_PATCH}")
|
||||
|
||||
file(GLOB SRC src/*.c)
|
||||
|
||||
include_directories(../../include)
|
||||
add_library(AthenaLibYaml STATIC ${SRC})
|
||||
|
||||
install(TARGETS AthenaLibYaml DESTINATION lib COMPONENT yaml)
|
||||
19
extern/yaml/LICENSE
vendored
Normal file
19
extern/yaml/LICENSE
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2006 Kirill Simonov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
27
extern/yaml/README
vendored
Normal file
27
extern/yaml/README
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
LibYAML - A C library for parsing and emitting YAML.
|
||||
|
||||
To build and install the library, run:
|
||||
$ ./configure
|
||||
$ make
|
||||
# make install
|
||||
|
||||
If you checked the source code from the Subversion repository, run
|
||||
$ ./bootstrap
|
||||
$ ./configure
|
||||
$ make
|
||||
# make install
|
||||
|
||||
For more information, check the LibYAML homepage:
|
||||
'http://pyyaml.org/wiki/LibYAML'.
|
||||
|
||||
Post your questions and opinions to the YAML-Core mailing list:
|
||||
'http://lists.sourceforge.net/lists/listinfo/yaml-core'.
|
||||
|
||||
Submit bug reports and feature requests to the LibYAML bug tracker:
|
||||
'http://pyyaml.org/newticket?component=libyaml'.
|
||||
|
||||
LibYAML is written by Kirill Simonov <xi@resolvent.net>. It is released
|
||||
under the MIT license. See the file LICENSE for more details.
|
||||
|
||||
This project is developed for Python Software Foundation as a part of
|
||||
Google Summer of Code under the mentorship of Clark Evans.
|
||||
28
extern/yaml/announcement.msg
vendored
Normal file
28
extern/yaml/announcement.msg
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
From: Kirill Simonov <xi@resolvent.net>
|
||||
To: yaml-core@lists.sourceforge.net
|
||||
Subject: LibYAML-0.1.4: A minor bugfix release
|
||||
|
||||
This is a minor bugfix release of LibYAML, a YAML parser and emitter
|
||||
written in C:
|
||||
|
||||
* Fixed a bug that prevented an empty mapping being used as a simple key
|
||||
(thank to spitzak(at)rhythm(dot)com).
|
||||
* Fixed pointer overflow when calculating the position of a potential
|
||||
simple key (thank to ppelletier(at)oblong(dot)com).
|
||||
* Fixed yaml.dll not exporting any symbols
|
||||
(thank to pxn11432(at)nifty(dot)com).
|
||||
* Added pkg-config support (thank to rainwoodman(at)gmail(dot)com).
|
||||
|
||||
LibYAML homepage: http://pyyaml.org/wiki/LibYAML
|
||||
TAR.GZ package: http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
|
||||
SVN repository: http://svn.pyyaml.org/libyaml/branches/stable
|
||||
Bug tracker: http://pyyaml.org/newticket?component=libyaml
|
||||
|
||||
The library is functionally complete, but the documentation is scarce
|
||||
and the API may change. For more information, you may check the project
|
||||
homepage, the doxygen-generated documentation in the `doc` directory of
|
||||
the source distribution, and examples in the `tests` directory.
|
||||
|
||||
LibYAML is written by Kirill Simonov <xi@resolvent.net> and released
|
||||
under the MIT license; see the file LICENSE for more details.
|
||||
|
||||
1396
extern/yaml/src/api.c
vendored
Normal file
1396
extern/yaml/src/api.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
extern/yaml/src/config.h
vendored
Normal file
4
extern/yaml/src/config.h
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
#define YAML_VERSION_MAJOR 0
|
||||
#define YAML_VERSION_MINOR 1
|
||||
#define YAML_VERSION_PATCH 6
|
||||
#define YAML_VERSION_STRING "0.1.6"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user