| ... | ... | @@ -1008,7 +1008,7 @@ pub const Value = extern union { |
| 1008 | 1008 | space: *BigIntSpace, |
| 1009 | 1009 | target: Target, |
| 1010 | 1010 | sema_kit: ?Module.WipAnalysis, |
| 1011 | | ) !BigIntConst { |
| 1011 | ) Module.CompileError!BigIntConst { |
| 1012 | 1012 | switch (val.tag()) { |
| 1013 | 1013 | .zero, |
| 1014 | 1014 | .bool_false, |
| ... | ... | @@ -1035,6 +1035,14 @@ pub const Value = extern union { |
| 1035 | 1035 | return BigIntMutable.init(&space.limbs, x).toConst(); |
| 1036 | 1036 | }, |
| 1037 | 1037 | |
| 1038 | .elem_ptr => { |
| 1039 | const elem_ptr = val.castTag(.elem_ptr).?.data; |
| 1040 | const array_addr = (try elem_ptr.array_ptr.getUnsignedIntAdvanced(target, sema_kit)).?; |
| 1041 | const elem_size = elem_ptr.elem_ty.abiSize(target); |
| 1042 | const new_addr = array_addr + elem_size * elem_ptr.index; |
| 1043 | return BigIntMutable.init(&space.limbs, new_addr).toConst(); |
| 1044 | }, |
| 1045 | |
| 1038 | 1046 | else => unreachable, |
| 1039 | 1047 | } |
| 1040 | 1048 | } |
| ... | ... | @@ -1815,7 +1823,10 @@ pub const Value = extern union { |
| 1815 | 1823 | return orderAgainstZeroAdvanced(lhs, null) catch unreachable; |
| 1816 | 1824 | } |
| 1817 | 1825 | |
| 1818 | | pub fn orderAgainstZeroAdvanced(lhs: Value, sema_kit: ?Module.WipAnalysis) !std.math.Order { |
| 1826 | pub fn orderAgainstZeroAdvanced( |
| 1827 | lhs: Value, |
| 1828 | sema_kit: ?Module.WipAnalysis, |
| 1829 | ) Module.CompileError!std.math.Order { |
| 1819 | 1830 | return switch (lhs.tag()) { |
| 1820 | 1831 | .zero, |
| 1821 | 1832 | .bool_false, |
| ... | ... | @@ -1851,6 +1862,21 @@ pub const Value = extern union { |
| 1851 | 1862 | .float_80 => std.math.order(lhs.castTag(.float_80).?.data, 0), |
| 1852 | 1863 | .float_128 => std.math.order(lhs.castTag(.float_128).?.data, 0), |
| 1853 | 1864 | |
| 1865 | .elem_ptr => { |
| 1866 | const elem_ptr = lhs.castTag(.elem_ptr).?.data; |
| 1867 | switch (try elem_ptr.array_ptr.orderAgainstZeroAdvanced(sema_kit)) { |
| 1868 | .lt => unreachable, |
| 1869 | .gt => return .gt, |
| 1870 | .eq => { |
| 1871 | if (elem_ptr.index == 0) { |
| 1872 | return .eq; |
| 1873 | } else { |
| 1874 | return .gt; |
| 1875 | } |
| 1876 | }, |
| 1877 | } |
| 1878 | }, |
| 1879 | |
| 1854 | 1880 | else => unreachable, |
| 1855 | 1881 | }; |
| 1856 | 1882 | } |