From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- .../ARM202U/EXAMPLES/SCATTER/UUE.C | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/SCATTER/UUE.C (limited to 'Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/SCATTER/UUE.C') diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/SCATTER/UUE.C b/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/SCATTER/UUE.C new file mode 100644 index 0000000..76d60c3 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/SCATTER/UUE.C @@ -0,0 +1,26 @@ +/* + A simple reoutine to UUENCODE a buffer. It does not split up the + uuencoded data into lines and append encode count bytes though. + It assumes that the input buffer is an integer multiple of 3 bytes long. + The number of bytes written to the output buffer is returned. +*/ +unsigned int encodedCount=0; +unsigned int uuencode(unsigned char *in,unsigned char *out,unsigned int count) +{ + unsigned char t0; + unsigned char t1; + unsigned char t2; + unsigned int result=0; + + for (;count;count-=3,in+=3,out+=4,result+=4) { + t0=in[0]; + *out=' '+(t0>>2); + t1=in[1]; + out[1]=' '+((t0<<4)&0x30)+(t1>>4); + t2=in[2]; + out[2]=' '+((t1<<2)&0x3C)+ (t2>>6); + out[3]=' '+(t2&0x3F); + } + encodedCount += count; + return result; +} -- cgit v1.2.3