Giter Site home page Giter Site logo

short = byte? about circularbuffer HOT 4 CLOSED

fdedraco avatar fdedraco commented on July 30, 2024
short = byte?

from circularbuffer.

Comments (4)

rlogiacco avatar rlogiacco commented on July 30, 2024

I don't understand your question. The library is capable of handling both short and byte types, but they are not the same: a short is a 16-bit data-type ranging from -32,768 to 32,767, a byte is an 8-bit data-type ranging from -128 to 127.
The library does nothing regarding data-type manipulation.

from circularbuffer.

fdedraco avatar fdedraco commented on July 30, 2024

so i can use
CircularBuffer<unsigned char,100> data;

for 8 bit unsigned number from 0-255?

i'm confused on how you describe short and char use same amount of memory.
i guess i'll just try and see if something break

from circularbuffer.

rlogiacco avatar rlogiacco commented on July 30, 2024

Don't be confused: you can use any data type you want.

As an example, I like to use uint8_t for unsigned 8 bits numbers, but that is exactly the same as byte or unsigned char.

I prefer the following because that helps me avoid confusion about the memory footprint: uint8_t, uint16_t, uint32_t, and uint64_t (unsigned) along with int8_t, int16_t, int32_t, and int64_t (signed).

Also you can use any other data type you like, including objects, structs or arrays... There's no limit on that front.

But remember, a short is not an 8 bit integer in Arduino world, that is 2 bytes, and as such it is the same type as int. I believe I did fix the confusing part in the README.

https://www.arduino.cc/reference/en/#variables
https://learn.sparkfun.com/tutorials/data-types-in-arduino
https://www.tutorialspoint.com/arduino/arduino_data_types.htm

from circularbuffer.

fdedraco avatar fdedraco commented on July 30, 2024

thanks, tried it and nothing broken, i forgot to report.
and thanks for the fix in README.
i was afraid if it somehow mutate the data entered if i used the wrong type.

The library does nothing regarding data-type manipulation

is the confirmation i need btw

from circularbuffer.

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.