| 1 |
root |
1.1 |
#include "EXTERN.h" |
| 2 |
|
|
#include "perl.h" |
| 3 |
|
|
#include "XSUB.h" |
| 4 |
|
|
|
| 5 |
|
|
MODULE = dinfo PACKAGE = dinfo |
| 6 |
|
|
|
| 7 |
|
|
PROTOTYPES: ENABLE |
| 8 |
|
|
|
| 9 |
|
|
void |
| 10 |
root |
1.2 |
nummer2str (char *nummer, int fill = 10) |
| 11 |
root |
1.1 |
PPCODE: |
| 12 |
|
|
int len; |
| 13 |
|
|
unsigned long long num; |
| 14 |
|
|
char bin[5]; |
| 15 |
|
|
|
| 16 |
|
|
for (len = num = 0; *nummer && len < 11; nummer++) |
| 17 |
|
|
if (*nummer >= '0' && *nummer <= '9') |
| 18 |
|
|
{ |
| 19 |
|
|
len++; |
| 20 |
|
|
num = num * 11 + *nummer - '0'; |
| 21 |
|
|
} |
| 22 |
|
|
|
| 23 |
|
|
while (len++ < 11) |
| 24 |
|
|
num = num * 11 + fill; |
| 25 |
|
|
|
| 26 |
|
|
bin[0] = num >> 32; |
| 27 |
|
|
bin[1] = (unsigned int)num >> 24; |
| 28 |
|
|
bin[2] = (unsigned int)num >> 16; |
| 29 |
|
|
bin[3] = (unsigned int)num >> 8; |
| 30 |
|
|
bin[4] = (unsigned int)num >> 0; |
| 31 |
|
|
|
| 32 |
|
|
XPUSHs (sv_2mortal (newSVpvn (bin, 5))); |
| 33 |
|
|
|