Shop OBEX P1 Docs P2 Docs Learn Events
Quick question regarding converting datatypes — Parallax Forums

Quick question regarding converting datatypes

BasilBasil Posts: 380
edited 2014-04-01 12:24 in Propeller 1
Hi All,

A nice easy one. I am just double checking as im sure I know the answer...

If I write a long to an index in an array of bytes, will the long be written across 4 bytes or truncated to 1 byte?

Comments

  • Mike GMike G Posts: 2,702
    edited 2014-04-01 04:30
    If I write a long to an index in an array of bytes, will the long be written across 4 bytes or truncated to 1 byte?
    You could write a quick test to verify what happens.
  • BasilBasil Posts: 380
    edited 2014-04-01 11:32
    I would if I had a dev board...

    I am waiting on my pcb to be made so am developing without hardware for a little while :)
  • JonnyMacJonnyMac Posts: 9,107
    edited 2014-04-01 12:03
    You will only get the lower byte because the destination is a byte.

    If you want to write across an array of bytes use bytemove().
  • BasilBasil Posts: 380
    edited 2014-04-01 12:24
    JonnyMac wrote: »
    You will only get the lower byte because the destination is a byte.

    If you want to write across an array of bytes use bytemove().


    Thanks!
Sign In or Register to comment.