<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">+ // Handle big-endian byte-swapping if necessary.</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">+ support::detail::packed_</span><span style="font-family:arial,sans-serif;font-size:13px">endian_specific_integral<</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">+ word_t, support::little, support::unaligned> EndianValue;</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">+ memcpy(&EndianValue, Array, sizeof(Array));</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">+</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">+ CurWord = EndianValue;</span><br><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Can you do:</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><font face="arial, sans-serif">CurWord = endian::read<word_t, support::little, support::unaligned>(Array)</font></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">?</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">-- Sean Silva</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 12, 2014 at 4:09 PM, Jordan Rose <span dir="ltr"><<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Committed in r221840.<br>
<span class="HOEnZb"><font color="#888888"><br>
Jordan<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
> On Nov 12, 2014, at 15:59 , Jordan Rose <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>> wrote:<br>
><br>
> I'm just going to write a gtest unit test for this. That's easy enough.<br>
><br>
> Jordan<br>
><br>
>> On Nov 12, 2014, at 15:58 , Rafael Avila de Espindola <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:<br>
>><br>
>> Would it reproduce with opt and an empty file?<br>
>><br>
>> Sent from my iPhone<br>
>><br>
>>> On Nov 12, 2014, at 18:54, Jordan Rose <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>> wrote:<br>
>>><br>
>>><br>
>>>> On Nov 12, 2014, at 15:38, Rafael Avila de Espindola <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:<br>
>>>><br>
>>>><br>
>>>><br>
>>>> Sent from my iPhone<br>
>>>><br>
>>>>> On Nov 12, 2014, at 18:22, Jordan Rose <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>> wrote:<br>
>>>>><br>
>>>>> Looks like it's just this:<br>
>>>>><br>
>>>>> diff --git a/include/llvm/Bitcode/BitstreamReader.h b/include/llvm/Bitcode/BitstreamReader.h<br>
>>>>> index 6b9c858..41e50e1 100644<br>
>>>>> --- a/include/llvm/Bitcode/BitstreamReader.h<br>
>>>>> +++ b/include/llvm/Bitcode/BitstreamReader.h<br>
>>>>> @@ -227,7 +227,7 @@ public:<br>
>>>>> bool AtEndOfStream() {<br>
>>>>> if (BitsInCurWord != 0)<br>
>>>>> return false;<br>
>>>>> - if (Size == NextChar)<br>
>>>>> + if (Size != 0 && Size == NextChar)<br>
>>>>> return true;<br>
>>>>> fillCurWord();<br>
>>>>> return BitsInCurWord == 0;<br>
>>>>><br>
>>>>> i.e. you forgot about the fact that we /start/ with both Size and NextChar equal to 0. Does this look like the right fix to you?<br>
>>>><br>
>>>><br>
>>>> Oh, so a call at the very start would fail. LGTM<br>
>>><br>
>>> Yup, I don't have a test case in LLVM's code, but Swift is checking explicitly for an empty file. Took me a while to track that down.<br>
>>><br>
>>> Thanks, I'll commit.<br>
>>> Jordan<br>
>>><br>
><br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>