[llvm-commits] [test-suite] r169808 - in /test-suite/trunk/MultiSource/Applications: ./ ALAC/

Michael Gottesman mgottesman at apple.com
Wed Dec 12 11:03:14 PST 2012


I just successfully ran both alacconvert-decode and alacconvert-encode on x86-64 ubuntu with Benjamin Kramer's changes. I also ran them successfully without his patch. So again we come back to what arch/os are you using = p?

Michael

On Dec 12, 2012, at 9:51 AM, Michael Gottesman <mgottesman at apple.com> wrote:

> I think he is using ubuntu on x86. I am just going to try and reproduce it on a virtual environment that I have set up (assuming he doesn't chime in soon saying this fixes it = p).
> 
> Michael
> 
> On Dec 12, 2012, at 9:49 AM, Benjamin Kramer <benny.kra at gmail.com> wrote:
> 
>> 
>> On 12.12.2012, at 18:10, Reed Kotler <rkotler at mips.com> wrote:
>> 
>>> closer now...
>>> 
>>> /tmp/cc9MNI6X.o: In function `main':
>>> Output/alacconvert-encode.llvm.bc:(.text+0x68a9): undefined reference to `operator new(unsigned int)'
>>> Output/alacconvert-encode.llvm.bc:(.text+0x6d85): undefined reference to `operator new(unsigned int)'
>>> Output/alacconvert-encode.llvm.bc:(.text+0xa931): undefined reference to `operator delete(void*)'
>>> /tmp/cc9MNI6X.o: In function `ALACEncoder::~ALACEncoder()':
>>> Output/alacconvert-encode.llvm.bc:(.text+0x13): undefined reference to `operator delete(void*)'
>>> /tmp/cc9MNI6X.o:(.rodata+0xa0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
>>> collect2: ld returned 1 exit status
>>> make[4]: [Output/alacconvert-encode.llc] Error 1 (ignored)
>>> /tmp/ccCpXpH2.o: In function `main':
>>> Output/alacconvert-decode.llvm.bc:(.text+0x68a9): undefined reference to `operator new(unsigned int)'
>>> Output/alacconvert-decode.llvm.bc:(.text+0x6d85): undefined reference to `operator new(unsigned int)'
>>> Output/alacconvert-decode.llvm.bc:(.text+0xa931): undefined reference to `operator delete(void*)'
>>> /tmp/ccCpXpH2.o: In function `ALACEncoder::~ALACEncoder()':
>>> Output/alacconvert-decode.llvm.bc:(.text+0x13): undefined reference to `operator delete(void*)'
>>> /tmp/ccCpXpH2.o:(.rodata+0xa0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
>>> collect2: ld returned 1 exit status
>>> make[4]: [Output/alacconvert-decode.llc] Error 1 (ignored)
>>> rkotler at laptop-rkotler:~/llvmpb3/build/projects/test-suite$
>> 
>> Does r169995 help?
>> 
>> - Ben
>>> 
>>> On 12/11/2012 04:49 PM, Michael Gottesman wrote:
>>>> I fixed that already. It is a bug I missed because my fs is case insensitive update your test suite.
>>>> 
>>>> On Dec 11, 2012, at 3:38 PM, Reed Kotler <rkotler at mips.com> wrote:
>>>> 
>>>>> I'm still unable to run "make" in test-suite for x86 with this test added.
>>>>> 
>>>>> 
>>>>> ******************** TEST (jit) 'minisat' FAILED! ********************
>>>>> Execution Context Diff:
>>>>> /home/rkotler/llvmpb3/build/projects/test-suite/tools/fpcmp: FP Comparison failed, not a numeric difference between 'T' and 'L'
>>>>> ******************** TEST (jit) 'minisat' ****************************
>>>>> make[3]: Leaving directory `/home/rkotler/llvmpb3/build/projects/test-suite/MultiSource/Applications/minisat'
>>>>> make[3]: Entering directory `/home/rkotler/llvmpb3/build/projects/test-suite/MultiSource/Applications/ALAC'
>>>>> Makefile:32: ../../../Multisource/Makefile.multisrc: No such file or directory
>>>>> make[3]: *** No rule to make target `../../../Multisource/Makefile.multisrc'.  Stop.
>>>>> make[3]: Leaving directory `/home/rkotler/llvmpb3/build/projects/test-suite/MultiSource/Applications/ALAC'
>>>>> make[2]: *** [ALAC/.makeall] Error 2
>>>>> make[2]: Leaving directory `/home/rkotler/llvmpb3/build/projects/test-suite/MultiSource/Applications'
>>>>> make[1]: *** [Applications/.makeall] Error 2
>>>>> make[1]: Leaving directory `/home/rkotler/llvmpb3/build/projects/test-suite/MultiSource'
>>>>> make: *** [MultiSource/.makeall] Error 2
>>>>> rkotler at ubuntu-rkotler:~/llvmpb3/build/projects/test-suite$
>>>>> 
>>>>> 
>>>>> 
>>>>> On 12/10/2012 05:58 PM, Michael Gottesman wrote:
>>>>>> Author: mgottesman
>>>>>> Date: Mon Dec 10 19:58:37 2012
>>>>>> New Revision: 169808
>>>>>> 
>>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=169808&view=rev
>>>>>> Log:
>>>>>> Added test ALAC (Apple Lossless Audio Codec).
>>>>>> 
>>>>>> Added:
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/ALACAudioTypes.h
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/ALACBitUtilities.c
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/ALACBitUtilities.h
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/ALACDecoder.cpp
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/ALACDecoder.h
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/ALACEncoder.cpp
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/ALACEncoder.h
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/ALACMagicCookieDescription.txt
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/APPLE_LICENSE.txt
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/CAFFileALAC.cpp
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/CAFFileALAC.h
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/EndianPortable.c
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/EndianPortable.h
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/LICENSE
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/Makefile
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/ReadMe.txt
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/ag_dec.c
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/ag_enc.c
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/aglib.h
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/alacconvert.reference_output
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/dp_dec.c
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/dp_enc.c
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/dplib.h
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/main.cpp
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/matrix_dec.c
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/matrix_enc.c
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/matrixlib.h
>>>>>>   test-suite/trunk/MultiSource/Applications/ALAC/tune.wav
>>>>>> Modified:
>>>>>>   test-suite/trunk/MultiSource/Applications/Makefile
>>>>>> 
>>>>>> Added: test-suite/trunk/MultiSource/Applications/ALAC/ALACAudioTypes.h
>>>>>> URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Applications/ALAC/ALACAudioTypes.h?rev=169808&view=auto
>>>>>> ==============================================================================
>>>>>> --- test-suite/trunk/MultiSource/Applications/ALAC/ALACAudioTypes.h (added)
>>>>>> +++ test-suite/trunk/MultiSource/Applications/ALAC/ALACAudioTypes.h Mon Dec 10 19:58:37 2012
>>>>>> @@ -0,0 +1,191 @@
>>>>>> +/*
>>>>>> + * Copyright (c) 2011 Apple Inc. All rights reserved.
>>>>>> + *
>>>>>> + * @APPLE_APACHE_LICENSE_HEADER_START@
>>>>>> + *
>>>>>> + * Licensed under the Apache License, Version 2.0 (the "License");
>>>>>> + * you may not use this file except in compliance with the License.
>>>>>> + * You may obtain a copy of the License at
>>>>>> + *
>>>>>> + *     http://www.apache.org/licenses/LICENSE-2.0
>>>>>> + *
>>>>>> + * Unless required by applicable law or agreed to in writing, software
>>>>>> + * distributed under the License is distributed on an "AS IS" BASIS,
>>>>>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>>>>>> + * See the License for the specific language governing permissions and
>>>>>> + * limitations under the License.
>>>>>> + *
>>>>>> + * @APPLE_APACHE_LICENSE_HEADER_END@
>>>>>> + */
>>>>>> +
>>>>>> +/*
>>>>>> +    File:        ALACAudioTypes.h
>>>>>> +*/
>>>>>> +
>>>>>> +#ifndef ALACAUDIOTYPES_H
>>>>>> +#define ALACAUDIOTYPES_H
>>>>>> +
>>>>>> +#if PRAGMA_ONCE
>>>>>> +#pragma once
>>>>>> +#endif
>>>>>> +
>>>>>> +#ifdef __cplusplus
>>>>>> +extern "C" {
>>>>>> +#endif
>>>>>> +
>>>>>> +#if PRAGMA_STRUCT_ALIGN
>>>>>> +    #pragma options align=mac68k
>>>>>> +#elif PRAGMA_STRUCT_PACKPUSH
>>>>>> +    #pragma pack(push, 2)
>>>>>> +#elif PRAGMA_STRUCT_PACK
>>>>>> +    #pragma pack(2)
>>>>>> +#endif
>>>>>> +
>>>>>> +#include <stdint.h>
>>>>>> +
>>>>>> +#define kChannelAtomSize 12
>>>>>> +
>>>>>> +enum
>>>>>> +{
>>>>>> +    kALAC_UnimplementedError   = -4,
>>>>>> +    kALAC_FileNotFoundError    = -43,
>>>>>> +    kALAC_ParamError           = -50,
>>>>>> +    kALAC_MemFullError         = -108
>>>>>> +};
>>>>>> +
>>>>>> +enum
>>>>>> +{
>>>>>> +    kALACFormatAppleLossless = 'alac',
>>>>>> +    kALACFormatLinearPCM = 'lpcm'
>>>>>> +};
>>>>>> +
>>>>>> +enum
>>>>>> +{
>>>>>> +    kALACMaxChannels    = 8,
>>>>>> +    kALACMaxEscapeHeaderBytes = 8,
>>>>>> +    kALACMaxSearches    = 16,
>>>>>> +    kALACMaxCoefs        = 16,
>>>>>> +    kALACDefaultFramesPerPacket = 4096
>>>>>> +};
>>>>>> +
>>>>>> +typedef uint32_t ALACChannelLayoutTag;
>>>>>> +
>>>>>> +enum
>>>>>> +{
>>>>>> +    kALACFormatFlagIsFloat                     = (1 << 0),     // 0x1
>>>>>> +    kALACFormatFlagIsBigEndian                 = (1 << 1),     // 0x2
>>>>>> +    kALACFormatFlagIsSignedInteger             = (1 << 2),     // 0x4
>>>>>> +    kALACFormatFlagIsPacked                    = (1 << 3),     // 0x8
>>>>>> +    kALACFormatFlagIsAlignedHigh               = (1 << 4),     // 0x10
>>>>>> +};
>>>>>> +
>>>>>> +enum
>>>>>> +{
>>>>>> +#if TARGET_RT_BIG_ENDIAN
>>>>>> +    kALACFormatFlagsNativeEndian       = kALACFormatFlagIsBigEndian
>>>>>> +#else
>>>>>> +    kALACFormatFlagsNativeEndian       = 0
>>>>>> +#endif
>>>>>> +};
>>>>>> +
>>>>>> +// this is required to be an IEEE 64bit float
>>>>>> +typedef double alac_float64_t;
>>>>>> +
>>>>>> +// These are the Channel Layout Tags used in the Channel Layout Info portion of the ALAC magic cookie
>>>>>> +enum
>>>>>> +{
>>>>>> +    kALACChannelLayoutTag_Mono          = (100<<16) | 1,    // C
>>>>>> +    kALACChannelLayoutTag_Stereo        = (101<<16) | 2,    // L R
>>>>>> +    kALACChannelLayoutTag_MPEG_3_0_B    = (113<<16) | 3,    // C L R
>>>>>> +    kALACChannelLayoutTag_MPEG_4_0_B    = (116<<16) | 4,    // C L R Cs
>>>>>> +    kALACChannelLayoutTag_MPEG_5_0_D    = (120<<16) | 5,    // C L R Ls Rs
>>>>>> +    kALACChannelLayoutTag_MPEG_5_1_D    = (124<<16) | 6,    // C L R Ls Rs LFE
>>>>>> +    kALACChannelLayoutTag_AAC_6_1 = (142<<16) | 7,    // C L R Ls Rs Cs LFE
>>>>>> +    kALACChannelLayoutTag_MPEG_7_1_B    = (127<<16) | 8     // C Lc Rc L R Ls Rs LFE    (doc: IS-13818-7 MPEG2-AAC)
>>>>>> +};
>>>>>> +
>>>>>> +// ALAC currently only utilizes these channels layouts. There is a one for one correspondance between a
>>>>>> +// given number of channels and one of these layout tags
>>>>>> +static const ALACChannelLayoutTag    ALACChannelLayoutTags[kALACMaxChannels] =
>>>>>> +{
>>>>>> +    kALACChannelLayoutTag_Mono,         // C
>>>>>> +    kALACChannelLayoutTag_Stereo,        // L R
>>>>>> +    kALACChannelLayoutTag_MPEG_3_0_B,    // C L R
>>>>>> +    kALACChannelLayoutTag_MPEG_4_0_B,    // C L R Cs
>>>>>> +    kALACChannelLayoutTag_MPEG_5_0_D,    // C L R Ls Rs
>>>>>> +    kALACChannelLayoutTag_MPEG_5_1_D,    // C L R Ls Rs LFE
>>>>>> +    kALACChannelLayoutTag_AAC_6_1,        // C L R Ls Rs Cs LFE
>>>>>> +    kALACChannelLayoutTag_MPEG_7_1_B    // C Lc Rc L R Ls Rs LFE    (doc: IS-13818-7 MPEG2-AAC)
>>>>>> +};
>>>>>> +
>>>>>> +// AudioChannelLayout from CoreAudioTypes.h. We never need the AudioChannelDescription so we remove it
>>>>>> +struct ALACAudioChannelLayout
>>>>>> +{
>>>>>> +    ALACChannelLayoutTag          mChannelLayoutTag;
>>>>>> +    uint32_t                      mChannelBitmap;
>>>>>> +    uint32_t                      mNumberChannelDescriptions;
>>>>>> +};
>>>>>> +typedef struct ALACAudioChannelLayout ALACAudioChannelLayout;
>>>>>> +
>>>>>> +struct AudioFormatDescription
>>>>>> +{
>>>>>> +    alac_float64_t mSampleRate;
>>>>>> +    uint32_t  mFormatID;
>>>>>> +    uint32_t  mFormatFlags;
>>>>>> +    uint32_t  mBytesPerPacket;
>>>>>> +    uint32_t  mFramesPerPacket;
>>>>>> +    uint32_t  mBytesPerFrame;
>>>>>> +    uint32_t  mChannelsPerFrame;
>>>>>> +    uint32_t  mBitsPerChannel;
>>>>>> +    uint32_t  mReserved;
>>>>>> +};
>>>>>> +typedef struct AudioFormatDescription  AudioFormatDescription;
>>>>>> +
>>>>>> +/* Lossless Definitions */
>>>>>> +
>>>>>> +enum
>>>>>> +{
>>>>>> +    kALACCodecFormat        = 'alac',
>>>>>> +    kALACVersion            = 0,
>>>>>> +    kALACCompatibleVersion    = kALACVersion,
>>>>>> +    kALACDefaultFrameSize    = 4096
>>>>>> +};
>>>>>> +
>>>>>> +// note: this struct is wrapped in an 'alac' atom in the sample description extension area
>>>>>> +// note: in QT movies, it will be further wrapped in a 'wave' atom surrounded by 'frma' and 'term' atoms
>>>>>> +typedef struct ALACSpecificConfig
>>>>>> +{
>>>>>> +    uint32_t                frameLength;
>>>>>> +    uint8_t                    compatibleVersion;
>>>>>> +    uint8_t                    bitDepth;                            // max 32
>>>>>> +    uint8_t                    pb;                                    // 0 <= pb <= 255
>>>>>> +    uint8_t                    mb;
>>>>>> +    uint8_t                    kb;
>>>>>> +    uint8_t                    numChannels;
>>>>>> +    uint16_t                maxRun;
>>>>>> +    uint32_t                maxFrameBytes;
>>>>>> +    uint32_t                avgBitRate;
>>>>>> +    uint32_t                sampleRate;
>>>>>> +
>>>>>> +} ALACSpecificConfig;
>>>>>> +
>>>>>> +
>>>>>> +// The AudioChannelLayout atom type is not exposed yet so define it here
>>>>>> +enum
>>>>>> +{
>>>>>> +    AudioChannelLayoutAID = 'chan'
>>>>>> +};
>>>>>> +
>>>>>> +#if PRAGMA_STRUCT_ALIGN
>>>>>> +    #pragma options align=reset
>>>>>> +#elif PRAGMA_STRUCT_PACKPUSH
>>>>>> +    #pragma pack(pop)
>>>>>> +#elif PRAGMA_STRUCT_PACK
>>>>>> +    #pragma pack()
>>>>>> +#endif
>>>>>> +
>>>>>> +#ifdef __cplusplus
>>>>>> +}
>>>>>> +#endif
>>>>>> +
>>>>>> +#endif    /* ALACAUDIOTYPES_H */
>>>>>> 
>>>>>> Added: test-suite/trunk/MultiSource/Applications/ALAC/ALACBitUtilities.c
>>>>>> URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Applications/ALAC/ALACBitUtilities.c?rev=169808&view=auto
>>>>>> ==============================================================================
>>>>>> --- test-suite/trunk/MultiSource/Applications/ALAC/ALACBitUtilities.c (added)
>>>>>> +++ test-suite/trunk/MultiSource/Applications/ALAC/ALACBitUtilities.c Mon Dec 10 19:58:37 2012
>>>>>> @@ -0,0 +1,260 @@
>>>>>> +/*
>>>>>> + * Copyright (c) 2011 Apple Inc. All rights reserved.
>>>>>> + *
>>>>>> + * @APPLE_APACHE_LICENSE_HEADER_START@
>>>>>> + *
>>>>>> + * Licensed under the Apache License, Version 2.0 (the "License");
>>>>>> + * you may not use this file except in compliance with the License.
>>>>>> + * You may obtain a copy of the License at
>>>>>> + *
>>>>>> + *     http://www.apache.org/licenses/LICENSE-2.0
>>>>>> + *
>>>>>> + * Unless required by applicable law or agreed to in writing, software
>>>>>> + * distributed under the License is distributed on an "AS IS" BASIS,
>>>>>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>>>>>> + * See the License for the specific language governing permissions and
>>>>>> + * limitations under the License.
>>>>>> + *
>>>>>> + * @APPLE_APACHE_LICENSE_HEADER_END@
>>>>>> + */
>>>>>> +
>>>>>> +/*=============================================================================
>>>>>> +    File:        ALACBitUtilities.c
>>>>>> +
>>>>>> +    $NoKeywords: $
>>>>>> +=============================================================================*/
>>>>>> +
>>>>>> +#include <stdio.h>
>>>>>> +#include "ALACBitUtilities.h"
>>>>>> +
>>>>>> +// BitBufferInit
>>>>>> +//
>>>>>> +void BitBufferInit( BitBuffer * bits, uint8_t * buffer, uint32_t byteSize )
>>>>>> +{
>>>>>> +    bits->cur        = buffer;
>>>>>> +    bits->end        = bits->cur + byteSize;
>>>>>> +    bits->bitIndex    = 0;
>>>>>> +    bits->byteSize    = byteSize;
>>>>>> +}
>>>>>> +
>>>>>> +// BitBufferRead
>>>>>> +//
>>>>>> +uint32_t BitBufferRead( BitBuffer * bits, uint8_t numBits )
>>>>>> +{
>>>>>> +    uint32_t        returnBits;
>>>>>> +
>>>>>> +    //Assert( numBits <= 16 );
>>>>>> +
>>>>>> +    returnBits = ((uint32_t)bits->cur[0] << 16) | ((uint32_t)bits->cur[1] << 8) | ((uint32_t)bits->cur[2]);
>>>>>> +    returnBits = returnBits << bits->bitIndex;
>>>>>> +    returnBits &= 0x00FFFFFF;
>>>>>> +
>>>>>> +    bits->bitIndex += numBits;
>>>>>> +
>>>>>> +    returnBits = returnBits >> (24 - numBits);
>>>>>> +
>>>>>> +    bits->cur        += (bits->bitIndex >> 3);
>>>>>> +    bits->bitIndex    &= 7;
>>>>>> +
>>>>>> +    //Assert( bits->cur <= bits->end );
>>>>>> +
>>>>>> +    return returnBits;
>>>>>> +}
>>>>>> +
>>>>>> +// BitBufferReadSmall
>>>>>> +//
>>>>>> +// Reads up to 8 bits
>>>>>> +uint8_t BitBufferReadSmall( BitBuffer * bits, uint8_t numBits )
>>>>>> +{
>>>>>> +    uint16_t        returnBits;
>>>>>> +
>>>>>> +    //Assert( numBits <= 8 );
>>>>>> +
>>>>>> +    returnBits = (bits->cur[0] << 8) | bits->cur[1];
>>>>>> +    returnBits = returnBits << bits->bitIndex;
>>>>>> +
>>>>>> +    bits->bitIndex += numBits;
>>>>>> +
>>>>>> +    returnBits = returnBits >> (16 - numBits);
>>>>>> +
>>>>>> +    bits->cur        += (bits->bitIndex >> 3);
>>>>>> +    bits->bitIndex    &= 7;
>>>>>> +
>>>>>> +    //Assert( bits->cur <= bits->end );
>>>>>> +
>>>>>> +    return (uint8_t)returnBits;
>>>>>> +}
>>>>>> +
>>>>>> +// BitBufferReadOne
>>>>>> +//
>>>>>> +// Reads one byte
>>>>>> +uint8_t BitBufferReadOne( BitBuffer * bits )
>>>>>> +{
>>>>>> +    uint8_t        returnBits;
>>>>>> +
>>>>>> +    returnBits = (bits->cur[0] >> (7 - bits->bitIndex)) & 1;
>>>>>> +
>>>>>> +    bits->bitIndex++;
>>>>>> +
>>>>>> +    bits->cur        += (bits->bitIndex >> 3);
>>>>>> +    bits->bitIndex    &= 7;
>>>>>> +
>>>>>> +    //Assert( bits->cur <= bits->end );
>>>>>> +
>>>>>> +    return returnBits;
>>>>>> +}
>>>>>> +
>>>>>> +// BitBufferPeek
>>>>>> +//
>>>>>> +uint32_t BitBufferPeek( BitBuffer * bits, uint8_t numBits )
>>>>>> +{
>>>>>> +    return ((((((uint32_t) bits->cur[0] << 16) | ((uint32_t) bits->cur[1] << 8) |
>>>>>> +            ((uint32_t) bits->cur[2])) << bits->bitIndex) & 0x00FFFFFF) >> (24 - numBits));
>>>>>> +}
>>>>>> +
>>>>>> +// BitBufferPeekOne
>>>>>> +//
>>>>>> +uint32_t BitBufferPeekOne( BitBuffer * bits )
>>>>>> +{
>>>>>> +    return ((bits->cur[0] >> (7 - bits->bitIndex)) & 1);
>>>>>> +}
>>>>>> +
>>>>>> +// BitBufferUnpackBERSize
>>>>>> +//
>>>>>> +uint32_t BitBufferUnpackBERSize( BitBuffer * bits )
>>>>>> +{
>>>>>> +    uint32_t        size;
>>>>>> +    uint8_t        tmp;
>>>>>> +
>>>>>> +    for ( size = 0, tmp = 0x80u; tmp &= 0x80u; size = (size << 7u) | (tmp & 0x7fu) )
>>>>>> +        tmp = (uint8_t) BitBufferReadSmall( bits, 8 );
>>>>>> +
>>>>>> +    return size;
>>>>>> +}
>>>>>> +
>>>>>> +// BitBufferGetPosition
>>>>>> +//
>>>>>> +uint32_t BitBufferGetPosition( BitBuffer * bits )
>>>>>> +{
>>>>>> +    uint8_t *        begin;
>>>>>> +
>>>>>> +    begin = bits->end - bits->byteSize;
>>>>>> +
>>>>>> +    return ((uint32_t)(bits->cur - begin) * 8) + bits->bitIndex;
>>>>>> +}
>>>>>> +
>>>>>> +// BitBufferByteAlign
>>>>>> +//
>>>>>> +void BitBufferByteAlign( BitBuffer * bits, int32_t addZeros )
>>>>>> +{
>>>>>> +    // align bit buffer to next byte boundary, writing zeros if requested
>>>>>> +    if ( bits->bitIndex == 0 )
>>>>>> +        return;
>>>>>> +
>>>>>> +    if ( addZeros )
>>>>>> +        BitBufferWrite( bits, 0, 8 - bits->bitIndex );
>>>>>> +    else
>>>>>> +        BitBufferAdvance( bits, 8 - bits->bitIndex );
>>>>>> +}
>>>>>> +
>>>>>> +// BitBufferAdvance
>>>>>> +//
>>>>>> +void BitBufferAdvance( BitBuffer * bits, uint32_t numBits )
>>>>>> +{
>>>>>> +    if ( numBits )
>>>>>> +    {
>>>>>> +        bits->bitIndex += numBits;
>>>>>> +        bits->cur += (bits->bitIndex >> 3);
>>>>>> +        bits->bitIndex &= 7;
>>>>>> +    }
>>>>>> +}
>>>>>> +
>>>>>> +// BitBufferRewind
>>>>>> +//
>>>>>> +void BitBufferRewind( BitBuffer * bits, uint32_t numBits )
>>>>>> +{
>>>>>> +    uint32_t    numBytes;
>>>>>> +
>>>>>> +    if ( numBits == 0 )
>>>>>> +        return;
>>>>>> +
>>>>>> +    if ( bits->bitIndex >= numBits )
>>>>>> +    {
>>>>>> +        bits->bitIndex -= numBits;
>>>>>> +        return;
>>>>>> +    }
>>>>>> +
>>>>>> +    numBits -= bits->bitIndex;
>>>>>> +    bits->bitIndex = 0;
>>>>>> +
>>>>>> +    numBytes    = numBits / 8;
>>>>>> +    numBits        = numBits % 8;
>>>>>> +
>>>>>> +    bits->cur -= numBytes;
>>>>>> +
>>>>>> +    if ( numBits > 0 )
>>>>>> +    {
>>>>>> +        bits->bitIndex = 8 - numBits;
>>>>>> +        bits->cur--;
>>>>>> +    }
>>>>>> +
>>>>>> +    if ( bits->cur < (bits->end - bits->byteSize) )
>>>>>> +    {
>>>>>> +        //DebugCMsg("BitBufferRewind: Rewound too far.");
>>>>>> +
>>>>>> +        bits->cur        = (bits->end - bits->byteSize);
>>>>>> +        bits->bitIndex    = 0;
>>>>>> +    }
>>>>>> +}
>>>>>> +
>>>>>> +// BitBufferWrite
>>>>>> +//
>>>>>> +void BitBufferWrite( BitBuffer * bits, uint32_t bitValues, uint32_t numBits )
>>>>>> +{
>>>>>> +    uint32_t                invBitIndex;
>>>>>> +
>>>>>> +    RequireAction( bits != nil, return; );
>>>>>> +    RequireActionSilent( numBits > 0, return; );
>>>>>> +
>>>>>> +    invBitIndex = 8 - bits->bitIndex;
>>>>>> +
>>>>>> +    while ( numBits > 0 )
>>>>>> +    {
>>>>>> +        uint32_t        tmp;
>>>>>> +        uint8_t        shift;
>>>>>> +        uint8_t        mask;
>>>>>> +        uint32_t        curNum;
>>>>>> +
>>>>>> +        curNum = MIN( invBitInde
>>> 
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list