let rec stripNopCasts (e:exp): exp =
match e.enode with
CastE(t, e') -> begin
match unrollType (typeOf e'), unrollType t with
TPtr _, TPtr _ -> (* okay to strip *)
stripNopCasts e'
(* strip casts from pointers to unsigned int/long*)
| (TPtr _ as t1), (TInt(ik,_) as t2)
when bitsSizeOf t1 = bitsSizeOf t2
&& not (isSigned ik) ->
stripNopCasts e'
| (TInt _ as t1), (TInt _ as t2)
when bitsSizeOf t1 = bitsSizeOf t2 -> (* Okay to strip.*)
stripNopCasts e'
| _ -> e
end
| _ -> e