From 0508fb3627966bd1298b614190fb9160cbcba415 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Fri, 22 Jun 2018 20:19:29 +0200 Subject: Fix "dereferencing type-punned pointer" warnings Signed-off-by: Clifford Wolf --- ice40/arch.cc | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/ice40/arch.cc b/ice40/arch.cc index be38015a..ce45b051 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -122,33 +122,33 @@ PortPin Arch::portPinFromId(IdString type) const // ----------------------------------------------------------------------- +static const ChipInfoPOD *get_chip_info(const RelPtr *ptr) +{ + return ptr->get(); +} + Arch::Arch(ArchArgs args) : args(args) { #ifdef ICE40_HX1K_ONLY if (args.type == ArchArgs::HX1K) { - chip_info = - reinterpret_cast *>(chipdb_blob_1k) - ->get(); + chip_info = get_chip_info( + reinterpret_cast *>(chipdb_blob_1k)); } else { log_error("Unsupported iCE40 chip type.\n"); } #else if (args.type == ArchArgs::LP384) { - chip_info = - reinterpret_cast *>(chipdb_blob_384) - ->get(); + chip_info = get_chip_info( + reinterpret_cast *>(chipdb_blob_384)); } else if (args.type == ArchArgs::LP1K || args.type == ArchArgs::HX1K) { - chip_info = - reinterpret_cast *>(chipdb_blob_1k) - ->get(); + chip_info = get_chip_info( + reinterpret_cast *>(chipdb_blob_1k)); } else if (args.type == ArchArgs::UP5K) { - chip_info = - reinterpret_cast *>(chipdb_blob_5k) - ->get(); + chip_info = get_chip_info( + reinterpret_cast *>(chipdb_blob_5k)); } else if (args.type == ArchArgs::LP8K || args.type == ArchArgs::HX8K) { - chip_info = - reinterpret_cast *>(chipdb_blob_8k) - ->get(); + chip_info = get_chip_info( + reinterpret_cast *>(chipdb_blob_8k)); } else { log_error("Unsupported iCE40 chip type.\n"); } -- cgit v1.2.3