     {
       /* match.d is displacement */
       /* match.l is length of match */
-      /* IDX_BY_BIT(flags,b) |= PUT_BIT(1,b); */
-      flags[b] = 1;
+      IDX_BY_BIT(flags,b) |= PUT_BIT(1,b);
       pack_match(&m,&match);
-      /* memcpy(dst + w,&m,sizeof(match_t)); */
-      *(/*(match_t*)*/(dst + w)) = ((m.dl >> 8) & 0xff);
-      *(/*(match_t*)*/(dst + w + 1)) = (m.dl & 0xff);
+      memcpy(dst + w,&m,sizeof(match_t));
       i += match.l;
       w += sizeof(match_t);
       b++;

#include <stdint.h>
#include <string.h>
#include <limits.h>
#include <cuda.h>

#include "common.h"
#include "lzss_gpu_help.h"

#define DISP_BITS 11
#define LEN_BITS 4

#define min(x,y) (((x) < (y)) ? (x) : (y))
#define max(x,y) (((x) < (y)) ? (y) : (x))

uint16_t match_len(uint8_t* old, uint8_t* fwd, uint16_t fwd_max)
{
  uint16_t i;
  for(i=2;(i<min(fwd_max,MAX_MATCH)) && (old[i]==fwd[i]);i++);
  return i;
}

void window_match(uint8_t* word, uint16_t back_max, uint16_t fwd_max, match_expanded_t* dst)
{
  uint16_t best = 0;
  uint16_t offset = 0;
