From 5e8e7203e9353b3203578393b7d75b9256c147a5 Mon Sep 17 00:00:00 2001 From: Nate Morrical Date: Sun, 8 Dec 2024 13:50:20 -0800 Subject: [PATCH] more formatting fixes --- source/slang/slang-emit-c-like.cpp | 86 +++++++++++++++--------------- source/slang/slang-emit-metal.cpp | 4 +- source/slang/slang-emit-spirv.cpp | 4 +- source/slang/slang-ir.cpp | 2 +- 4 files changed, 48 insertions(+), 48 deletions(-) diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp index b6b05b14b0..79c0aae144 100644 --- a/source/slang/slang-emit-c-like.cpp +++ b/source/slang/slang-emit-c-like.cpp @@ -3869,34 +3869,34 @@ void CLikeSourceEmitter::emitVecNOrScalar( { m_writer->emit("make_"); - switch (elementType->getOp()) + switch (elementType->getOp()) { - case kIROp_Int8Type: - m_writer->emit("char"); - break; - case kIROp_Int16Type: - m_writer->emit("short"); - break; - case kIROp_IntType: - m_writer->emit("int"); - break; - case kIROp_Int64Type: - m_writer->emit("longlong"); - break; - case kIROp_UInt8Type: - m_writer->emit("uchar"); - break; - case kIROp_UInt16Type: - m_writer->emit("ushort"); - break; - case kIROp_UIntType: - m_writer->emit("uint"); - break; - case kIROp_UInt64Type: - m_writer->emit("ulonglong"); - break; - default: - SLANG_ABORT_COMPILATION("Unhandled type emitting CUDA vector"); + case kIROp_Int8Type: + m_writer->emit("char"); + break; + case kIROp_Int16Type: + m_writer->emit("short"); + break; + case kIROp_IntType: + m_writer->emit("int"); + break; + case kIROp_Int64Type: + m_writer->emit("longlong"); + break; + case kIROp_UInt8Type: + m_writer->emit("uchar"); + break; + case kIROp_UInt16Type: + m_writer->emit("ushort"); + break; + case kIROp_UIntType: + m_writer->emit("uint"); + break; + case kIROp_UInt64Type: + m_writer->emit("ulonglong"); + break; + default: + SLANG_ABORT_COMPILATION("Unhandled type emitting CUDA vector"); } m_writer->emitRawText(std::to_string(N).c_str()); @@ -3912,7 +3912,7 @@ void CLikeSourceEmitter::emitVecNOrScalar( } // In other languages, we can output the Slang vector type directly - else + else { emitType(vectorType); } @@ -3965,22 +3965,22 @@ void CLikeSourceEmitter::emitBitfieldExtractImpl(IRInst* inst) String one; switch (bitWidth) { - case 8: - one = "uint8_t(1)"; - break; - case 16: - one = "uint16_t(1)"; - break; - case 32: - one = "uint32_t(1)"; - break; - case 64: - one = "uint64_t(1)"; - break; - default: - SLANG_DIAGNOSE_UNEXPECTED(getSink(), SourceLoc(), "unexpected bit width"); + case 8: + one = "uint8_t(1)"; + break; + case 16: + one = "uint16_t(1)"; + break; + case 32: + one = "uint32_t(1)"; + break; + case 64: + one = "uint64_t(1)"; + break; + default: + SLANG_DIAGNOSE_UNEXPECTED(getSink(), SourceLoc(), "unexpected bit width"); } - + // Emit open paren and type cast for later sign extension if (isSigned) { diff --git a/source/slang/slang-emit-metal.cpp b/source/slang/slang-emit-metal.cpp index 59e894f8a7..6b7e0c2498 100644 --- a/source/slang/slang-emit-metal.cpp +++ b/source/slang/slang-emit-metal.cpp @@ -1045,7 +1045,7 @@ void MetalSourceEmitter::emitSimpleTypeKnowingCount(IRType* type, IRIntegerValue { // NM: note, "ulong/ushort" is only type that works for i16/i64 vec, but can't be used for // scalars. (See metal specification pg 26) - + switch (type->getOp()) { case kIROp_VoidType: @@ -1065,7 +1065,7 @@ void MetalSourceEmitter::emitSimpleTypeKnowingCount(IRType* type, IRIntegerValue m_writer->emit("long"); return; case kIROp_UInt64Type: - if (elementCount > 1) + if (elementCount > 1) m_writer->emit("ulong"); else m_writer->emit("uint64_t"); diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index ec16a00be9..583ab8d4bb 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -6529,7 +6529,7 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex Slang::IRType* elementType = dataType; if (vectorType) elementType = vectorType->getElementType(); - + const IntInfo i = getIntTypeInfo(elementType); // NM: technically, using bitfield intrinsics for anything non-32-bit goes against @@ -6554,7 +6554,7 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex Slang::IRType* elementType = dataType; if (vectorType) elementType = vectorType->getElementType(); - + const IntInfo i = getIntTypeInfo(elementType); if (i.width == 64) diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index e030f21d4d..9eec224580 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -3642,7 +3642,7 @@ IRInst* IRBuilder::emitGetSequentialIDInst(IRInst* rttiObj) addInst(inst); return inst; } - + IRInst* IRBuilder::emitBitfieldExtract(IRType* type, IRInst* value, IRInst* offset, IRInst* bits) { auto inst = createInst(this, kIROp_BitfieldExtract, type, value, offset, bits);