Code Monkey home page Code Monkey logo

Comments (5)

mmcs85 avatar mmcs85 commented on July 17, 2024

I don't fallow your logic on what are you trying to convert and whats wrong.

SerializationHelper.DecimalToBinary is the same implementation from eosjs2 and converts a string to a byte[] representation in a given size.

Can you give more details on what you are trying to test? Function call?

string doubleStr = "10001";
var doubleBytes = SerializationHelper.DecimalToBinary(8, doubleStr);
returns: 17 39 0 0 0 0 0 0

var doubleBytes2 = BitConverter.GetBytes(Convert.ToUInt64(doubleStr));
returns: 17 39 0 0 0 0 0 0

same for the 16 bytes version...

Even thought I find your pull request a more cleaner solution is not as generic as the eosjs2 version. Not that we need anything othern than 4, 8, 16 bytes storage size.

from eos-sharp.

filipniziol avatar filipniziol commented on July 17, 2024

Strange - I wonder then why my result is

string doubleStr = "10001";
var doubleBytes = SerializationHelper.DecimalToBinary(8, doubleStr);
returns: 17 0 0 0 0 0 0 0

from eos-sharp.

mmcs85 avatar mmcs85 commented on July 17, 2024

Can you execute this on your target machine?
bool le = BitConverter.IsLittleEndian;

What is the result?

What is your OS and hardware specifications?

from eos-sharp.

filipniziol avatar filipniziol commented on July 17, 2024

The result is true.

Windows 10 Professional, 64 bit

from eos-sharp.

mmcs85 avatar mmcs85 commented on July 17, 2024

I'm using same OS and the same littleendianess this may be hardware related or you are using other version of the netstandard. Other than that I can't reproduce this behavior.

Created some unit tests for this you may try the different approaches.

Going to close this issue but feel free to repopen if you got more detail.

from eos-sharp.

Related Issues (20)

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.