File: Elf.xs

package info (click to toggle)
libdigest-elf-perl 1.42-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 80 kB
  • sloc: perl: 22; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 431 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

// $VERSION = sprintf( "%s", q{$Id: Elf.xs,v 1.4 2002/05/15 23:08:19 steve Exp $} =~ /(\d+\.\d+)/ );

MODULE = Digest::Elf		PACKAGE = Digest::Elf		

unsigned long
elf ( sval )
	char * sval;

	CODE:
		unsigned long h = 0, g;

		while ( *sval )
		{
			h = ( h << 4 ) + *sval++;
			if ( g = h & 0xF0000000 )
				h ^= g >> 24;

			h &= ~g;
		}
		RETVAL = h;

	OUTPUT:
		RETVAL