adler32.~h

来自「Jpeg编解码器的源代码」· ~H 代码 · 共 41 行

~H
41
字号
#ifndef CB__ADLER32_H
#define CB__ADLER32_H
//
// Copyright (c) 1997,1998 Colosseum Builders, Inc.
// All rights reserved.
//
// Colosseum Builders, Inc. makes no warranty, expressed or implied
// with regards to this software. It is provided as is.
//
// See the README.TXT file that came with this software for restrictions
// on the use and redistribution of this file or send E-mail to
// info@colosseumbuilders.com
//

//
//  Title:  PNG Checksum Function Declarations
//
//  Author:  John M. Miano  miano@colosseumbuilders.com
//
//  Description:
//
//    Adler32 Checksum Definition and Implementation
//

#include "systemspecific.h"

inline UBYTE4 Adler (UBYTE4 adler, UBYTE1 value)
{
  static const UBYTE4 prime = 65521 ;

  UBYTE4 lo = adler & 0xFFFF ;
  UBYTE4 hi = (adler >> 16) & 0xFFFF ;

  lo = (lo + value) % prime ;
  hi = (lo + hi) % prime ;
  UBYTE4 result = (hi << 16) | lo ;
  return result ;
}

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?