Skip to content

Instantly share code, notes, and snippets.

@dcoutts
Created January 25, 2020 16:29
Show Gist options
  • Save dcoutts/095d84fc00dfc8983d64fdb43ae35376 to your computer and use it in GitHub Desktop.
Save dcoutts/095d84fc00dfc8983d64fdb43ae35376 to your computer and use it in GitHub Desktop.
placeByteArray# CMM primop
#include "Cmm.h"
/* Place a ByteArray# object header so that its payload is at the given address.
The payload pointer we're given points to the first byte of the payload,
so we have to place the object header immediately before it. The caller
must ensure that the space before the payload is appropriately allocated
so that we can use it.
*/
stg_placeByteArrayzh ( W_ payload, W_ n )
{
gcptr p;
p = payload - SIZEOF_StgArrBytes;
SET_HDR(p, stg_ARR_WORDS_info, CCCS);
StgArrBytes_bytes(p) = n;
return (p);
}
@dcoutts
Copy link
Author

dcoutts commented Jan 25, 2020

Apparently P_ is the right type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment