diff options
author | Alec Murphy <alec@checksum.fail> | 2017-07-08 12:10:14 -0400 |
---|---|---|
committer | Alec Murphy <alec@checksum.fail> | 2017-07-08 12:10:14 -0400 |
commit | 26915252b0ba04446377d9235abb775891e7d943 (patch) | |
tree | e3562811e9280b2db1aaf6f4570f4f5d4a11ed45 | |
parent | 9eabaeab79df776c35b8833e3bb64719c1136052 (diff) |
Add Endian.HC functions from minexew's SnailNet library
-rw-r--r-- | Endian.HC | 15 | ||||
-rw-r--r-- | FilePNG.HC | 2 | ||||
-rw-r--r-- | README.md | 7 |
3 files changed, 23 insertions, 1 deletions
diff --git a/Endian.HC b/Endian.HC new file mode 100644 index 0000000..a64b70f --- /dev/null +++ b/Endian.HC @@ -0,0 +1,15 @@ +U16 htons(U16 h) { + return ((h >> 8) | (h << 8)) & 0xffff; +} + +U16 ntohs(U16 h) { + return ((h >> 8) | (h << 8)) & 0xffff; +} + +U32 htonl(U32 h) { + return ((h >> 24) | ((h & 0x00ff0000) >> 8) | ((h & 0x0000ff00) << 8) | (h << 24)) & 0xffffffff; +} + +U32 ntohl(U32 h) { + return ((h >> 24) | ((h & 0x00ff0000) >> 8) | ((h & 0x0000ff00) << 8) | (h << 24)) & 0xffffffff; +} @@ -234,7 +234,7 @@ public I64 PNGWrite(U8 *filename,CDC *dc,I64 bits=4) FileWrite(filename,png,size); Free(png); return size; -} +} #help_index "Graphics/PNG Files;Graphics/Scrn" public I64 PNGScrnCapture(U8 *filename,I64 bits=4,Bool include_zoom=TRUE) @@ -2,3 +2,10 @@ PNG support for TempleOS ![FilePNG](https://raw.githubusercontent.com/tramplersheikhs/filepng/master/example.png "FilePNG") + +`#include "Endian"` (if needed) + +`#include "FilePNG"` + + +`PNGScrnCapture;` and `PNGWrite("filename.png");` functions are present. |