Search Unity

Question Bitwise operations on float to send to shader (BitConverter.GetBytes on Burst)

Discussion in 'Burst' started by Guedez, Nov 1, 2020.

  1. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    827
    Currently I am doing this abomination:
    BitConverter.ToSingle(BitConverter.GetBytes((uint)((ToShort(data._00) << 16) | ((adj.up != default ? 1 : 0)) & 0x0000FFFF)), 0);


    But burst don't like it, probably because BitConverter.GetBytes return an array. How can I convert that to a 'burstable' piece of code?
     
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,271
    math.asuint
    math.asfloat