Code Monkey home page Code Monkey logo

welees / endian Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 11 KB

Endian is a cross-platform, general-purpose c++ little endian/big endian solution that eliminates the need for users to explicitly specify the conversion mode each time they access different endian data. Once you declare a variable using a type in Endian, you don't need to specify any explicit conversion for it, just use it as if it were a standard type supported by the CPU.

C 77.11% C++ 22.89%

endian's Introduction

endian

Endian is a cross-platform, general-purpose c++ little endian/big endian solution that eliminates the need for users to explicitly specify the conversion mode each time they access different endian data. Once you declare a variable using a type in Endian, you don't need to specify any explicit conversion for it, just use it as if it were a standard type supported by the CPU.

The example:

INT32    i32=0x12345678;
LEINT32  l32=i32;
BEINT32  b32=i32;
UINT32   u32=0x12345678;
LEUINT32 lu32=u32;
BEUINT32 bu32=u32;

printf("INT32 Raw Data    : %08XH\nLEINT32 Raw Data  : %08XH, LEINT32 Output    : %08XH\nBEINT32 Raw Data  : %08XH, BEINT32 Output    : %08XH\n",i32,*((PINT32)&l32),l32.Get(),*((PINT32)&b32),(INT32)b32);
printf("UINT32 Raw Data   : %08XH\nLEUINT32 Raw Data : %08XH, LEUINT32 Output   : %08XH\nBEUINT32 Raw Data : %08XH, BEUINT32 Output   : %08XH\n",u32,*((PUINT32)&lu32),lu32.Get(),*((PUINT32)&bu32),(UINT32)bu32);

Here we can get the result:

INT32 Raw Data : 12345678H

LEINT32 Raw Data : 12345678H, LEINT32 Output : 12345678H

BEINT32 Raw Data : 78563412H, BEINT32 Output : 12345678H

UINT32 Raw Data : 12345678H

LEUINT32 Raw Data : 12345678H, LEUINT32 Output : 12345678H

BEUINT32 Raw Data : 78563412H, BEUINT32 Output : 12345678H

endian's People

Contributors

welees avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.