summaryrefslogtreecommitdiff
path: root/lowlevelunit.pas
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2015-10-20 12:29:29 +0200
committerErich Eckner <git@eckner.net>2015-10-20 12:29:29 +0200
commit907d704462b445c67abe06f147c6a4a490022710 (patch)
tree9d209f385cd5df9b137f8331b89fd8d83648b676 /lowlevelunit.pas
parent9992352d91dbf2f5ee59dd23c7a970312a0d2bfb (diff)
downloadunits-907d704462b445c67abe06f147c6a4a490022710.tar.xz
base64Encode neu in lowlevelunit.pas
Diffstat (limited to 'lowlevelunit.pas')
-rw-r--r--lowlevelunit.pas18
1 files changed, 18 insertions, 0 deletions
diff --git a/lowlevelunit.pas b/lowlevelunit.pas
index 7ad86a4..94ada62 100644
--- a/lowlevelunit.pas
+++ b/lowlevelunit.pas
@@ -82,6 +82,8 @@ function hexDump(p: pointer; cnt: longint): string;
function base64ToBin(var s: string): boolean;
function base64Decode(const s: string; out i: qword): boolean; overload;
function base64Decode(const s: string; out i: longword): boolean; overload;
+function base64Encode(i: longword): string; overload;
+function base64Encode(i,siz: longword): string; overload;
function mirrorBits(qw: qword): qword; overload;
function mirrorBits(lw: longword): longword; overload;
function mirrorBits(w: word): word; overload;
@@ -713,6 +715,22 @@ begin
i:=0;
end;
+function base64Encode(i: longword): string;
+begin
+ result:=base64Encode(i,(8*sizeof(i)+7) div 6);
+end;
+
+function base64Encode(i,siz: longword): string;
+var
+ j: longint;
+begin
+ result:='';
+ for j:=0 to siz-1 do begin
+ result:=base64Chars[i and $3f]+result;
+ i:=i shr 6;
+ end;
+end;
+
function mirrorBits(qw: qword): qword;
begin
result:=