From 0319e52555f8ed4240e61a353323783958c6a477 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Thu, 27 Feb 2025 16:37:35 -0800 Subject: [PATCH] address comments --- specs/language/conversions.tex | 43 ++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/specs/language/conversions.tex b/specs/language/conversions.tex index 9fa2b221..511ad019 100644 --- a/specs/language/conversions.tex +++ b/specs/language/conversions.tex @@ -121,8 +121,8 @@ \Sec{Flat conversion}{Conv.flat} \p There is a flattened order of subobjects for an aggregate, \texttt{A}, -\texttt{A$^\prime$}, as described in section \ref{Decl.Init.Agg}. An aggregate, -\texttt{A}, can be flat converted to an aggregate, \texttt{B}, whose flattened +\texttt{A$^\prime$}, as described in section \ref{Decl.Init.Agg}. A prvalue of an aggregate, +\texttt{A}, can be flat converted to a prvalue of an aggregate, \texttt{B}, whose flattened form is \texttt{B$^\prime$}, if the following conditions are true: \begin{itemize} \item The length of \texttt{A$^\prime$}, \texttt{N}, is greater than or equal to the @@ -131,6 +131,18 @@ implicit conversion from \texttt{A$^\prime$[I]} to \texttt{B$^\prime$[I]}. \end{itemize} +\p A glvalue of type \texttt{T[N]} can be converted to a cxvalue of type \texttt{T}. + +%{This is true if N is >= M but if N = M then there isnt really a cast} +\p A glvalue of type \texttt{T[N]} can be converted to a cxvalue of type \texttt{T[M]}, +if \texttt{N} is greater than \texttt{M}. + +\p A glvalue of type \texttt{T[N]} can be converted to a cxvalue of type +\texttt{vector}, if \texttt{N} is greater than or equal to \texttt{M}. + +\p A glvalue of type \texttt{vector} can be converted to a cxvalue of +type \texttt{T[M]}, if \texttt{N} is greater than or equal to \texttt{M}. + \Sec{Vector splat conversion}{Conv.vsplat} \p A glvalue of type \texttt{T} can be converted to a cxvalue of type @@ -143,41 +155,36 @@ prvalue of type \texttt{matrix}. The destination value is the source value replicated into each element of the destination. -\p A glvalue of type \texttt{vector} can be converted to a cxvalue of type -\texttt{vector} or a prvalue of type \texttt{vector} can be converted +\p A prvalue of type \texttt{vector} can be converted to a prvalue of type \texttt{vector}. The destination value is the value in the source vector replicated into each element of the destination. \Sec{Array and Class splat conversion}{Conv.asplat} -\p A glvalue of type \texttt{T} can be converted to a cxvalue of type -\texttt{struct S} or a prvalue of type \texttt{T} can be converted to a +\p A prvalue of type \texttt{T} can be converted to a prvalue of type \texttt{struct S}, if there are valid conversions from \texttt{T} to each \texttt{U} in flattened \texttt{S}, see section \ref{Decl.init.Agg} for description of a flattened ordering. The destination value is the source value \texttt{T} replicated into each element of the flattened \texttt{S}. -\p A glvalue of type \texttt{vector} can be converted to a cxvalue of type -\texttt{struct S} or a prvalue of type \texttt{vector} can be converted to a +\p A prvalue of type \texttt{vector} can be converted to a prvalue of type \texttt{struct S}, if there are valid conversions from \texttt{T} to each \texttt{U} in flattened \texttt{S}. The destination value is the value in the source vector replicated into each element of the flattened \texttt{S}. -\p A glvalue of type \texttt{T} can be converted to a cxvalue of type -\texttt{U[]} or a prvalue of type \texttt{T} can be converted to a -prvalue of type \texttt{U[]}, if there are valid conversions from +\p A prvalue of type \texttt{T} can be converted to a +prvalue of type \texttt{U[N]}, if there are valid conversions from \texttt{T} to each \texttt{V} in flattened \texttt{U}. The destination value is the source value \texttt{T} replicated into each element of the flattened -\texttt{U[]}. +\texttt{U[N]}. -\p A glvalue of type \texttt{vector} can be converted to a cxvalue of type -\texttt{U[]} or a prvalue of type \texttt{vector} can be converted to a -prvalue of type \texttt{U[]}, if there are valid conversions from +\p A prvalue of type \texttt{vector} can be converted to a +prvalue of type \texttt{U[N]}, if there are valid conversions from \texttt{T} to each \texttt{V} in flattened \texttt{U}. The destination value is the value in the source vector replicated into each element of the flattened -\texttt{U[]}. +\texttt{U[N]}. \Sec{Vector and matrix truncation conversion}{Conv.vtrunc} @@ -211,14 +218,14 @@ \Sec{Component-wise conversions}{Conv.cwise} -\p A glvalue of type \texttt{vector} can be converted to a cxvalue of type +\p A glvalue of type \texttt{vector} can be converted to a prvalue of type \texttt{vector}, or a prvalue of type \texttt{vector} can be converted to a prvalue of type \texttt{vector}. The source value is converted by performing the appropriate conversion of each element of type \texttt{T} to an element of type \texttt{V} following the rules for standard conversions in chapter \ref{Conv}. -\p A glvalue of type \texttt{matrix} can be converted to a cxvalue of +\p A glvalue of type \texttt{matrix} can be converted to a prvalue of type \texttt{matrix}, or a prvalue of type \texttt{matrix} can be converted to a prvalue of type \texttt{matrix}. The source value is converted by performing the appropriate conversion of each element of type