Skip to content

Commit

Permalink
Avoid cast warnings in generated code.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Aug 12, 2023
1 parent a5e1700 commit 865f060
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Futhark/CodeGen/Backends/GenericC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ defError msg stacktrace = do
lmadcopyCPU :: DoLMADCopy op s
lmadcopyCPU _ t shape dst (dstoffset, dststride) src (srcoffset, srcstride) = do
let fname :: String
fname =
(fname, ty) =
case primByteSize t :: Int of
1 -> "lmad_copy_1b"
2 -> "lmad_copy_2b"
4 -> "lmad_copy_4b"
8 -> "lmad_copy_8b"
1 -> ("lmad_copy_1b", [C.cty|typename uint8_t|])
2 -> ("lmad_copy_2b", [C.cty|typename uint16_t|])
4 -> ("lmad_copy_4b", [C.cty|typename uint32_t|])
8 -> ("lmad_copy_8b", [C.cty|typename uint64_t|])
k -> error $ "lmadcopyCPU: " <> error (show k)
r = length shape
dststride_inits = [[C.cinit|$exp:e|] | Count e <- dststride]
Expand All @@ -78,9 +78,9 @@ lmadcopyCPU _ t shape dst (dstoffset, dststride) src (srcoffset, srcstride) = do
stm
[C.cstm|
$id:fname(ctx, $int:r,
$exp:dst, $exp:(unCount dstoffset),
($ty:ty*) $exp:dst, $exp:(unCount dstoffset),
(typename int64_t[]){ $inits:dststride_inits },
$exp:src, $exp:(unCount srcoffset),
($ty:ty*) $exp:src, $exp:(unCount srcoffset),
(typename int64_t[]){ $inits:srcstride_inits },
(typename int64_t[]){ $inits:shape_inits });|]

Expand Down

0 comments on commit 865f060

Please sign in to comment.