<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[2 unsigned short in einem signed long speichern?]]></title><description><![CDATA[<p>Hi</p>
<p>Die Frage steht im Topic. Wie stell ich das am geschicksten an. Ich brauche das ganze um mit der libtiff mehrere long und short vectoren in einem custom Tag eines Tiffs zu speichern. Der Tag ist vom Typ long.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/278624/2-unsigned-short-in-einem-signed-long-speichern</link><generator>RSS for Node</generator><lastBuildDate>Tue, 25 Aug 2026 04:30:13 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/278624.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 09 Dec 2010 21:48:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 2 unsigned short in einem signed long speichern? on Thu, 09 Dec 2010 21:48:32 GMT]]></title><description><![CDATA[<p>Hi</p>
<p>Die Frage steht im Topic. Wie stell ich das am geschicksten an. Ich brauche das ganze um mit der libtiff mehrere long und short vectoren in einem custom Tag eines Tiffs zu speichern. Der Tag ist vom Typ long.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1992272</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1992272</guid><dc:creator><![CDATA[Fahrrad]]></dc:creator><pubDate>Thu, 09 Dec 2010 21:48:32 GMT</pubDate></item><item><title><![CDATA[Reply to 2 unsigned short in einem signed long speichern? on Thu, 09 Dec 2010 21:51:50 GMT]]></title><description><![CDATA[<p>Geht nicht, ein long muss nicht doppelt so gross sein wie ein short.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1992274</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1992274</guid><dc:creator><![CDATA[undef]]></dc:creator><pubDate>Thu, 09 Dec 2010 21:51:50 GMT</pubDate></item><item><title><![CDATA[Reply to 2 unsigned short in einem signed long speichern? on Thu, 09 Dec 2010 22:08:22 GMT]]></title><description><![CDATA[<p>undef schrieb:</p>
<blockquote>
<p>Geht nicht, ein long muss nicht doppelt so gross sein wie ein short.</p>
</blockquote>
<p>Und? Dann prüft man das eben zur Compilezeit.</p>
<p>Die geschickteste Version ist, einen der shorts um die Länge eines shorts nach links zu shiften, die beiden shorts dann zu verodern und im long zu speichern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1992287</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1992287</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Thu, 09 Dec 2010 22:08:22 GMT</pubDate></item><item><title><![CDATA[Reply to 2 unsigned short in einem signed long speichern? on Fri, 10 Dec 2010 07:15:35 GMT]]></title><description><![CDATA[<p>ich habs jetzt so gemacht:</p>
<pre><code class="language-cpp">union bla {
		short	a[2];
		long	b;
	};

	bla bl;
	bl.a[0] = 2;
	bl.a[1] = 3;

	long blub = bl.b;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1992354</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1992354</guid><dc:creator><![CDATA[Fahrrad]]></dc:creator><pubDate>Fri, 10 Dec 2010 07:15:35 GMT</pubDate></item><item><title><![CDATA[Reply to 2 unsigned short in einem signed long speichern? on Fri, 10 Dec 2010 07:31:42 GMT]]></title><description><![CDATA[<p>Das war die Schlechteste aller Möglichkeiten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1992357</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1992357</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Fri, 10 Dec 2010 07:31:42 GMT</pubDate></item><item><title><![CDATA[Reply to 2 unsigned short in einem signed long speichern? on Fri, 10 Dec 2010 07:33:03 GMT]]></title><description><![CDATA[<p>kannst du auch sagen warum?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1992360</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1992360</guid><dc:creator><![CDATA[Fahrrad]]></dc:creator><pubDate>Fri, 10 Dec 2010 07:33:03 GMT</pubDate></item><item><title><![CDATA[Reply to 2 unsigned short in einem signed long speichern? on Fri, 10 Dec 2010 08:00:23 GMT]]></title><description><![CDATA[<p>Weil es undefiniertes Verhalten erzeugt. Es funktioniert zwar häufig (bisher eigentlich immer), aber der Standard garantiert nur, dass nur der Wert gültig ist, der zuletzt beschrieben worden ist. Wenn der Compiler ein seltsames Speicherlayout für die Elemente der union benutzt kann das Ergebnis falsch sein.<br />
Am besten benutzt du, wie bereits oben erwähnt, Byteshifting und Verorderung.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1992376</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1992376</guid><dc:creator><![CDATA[DocShoe]]></dc:creator><pubDate>Fri, 10 Dec 2010 08:00:23 GMT</pubDate></item></channel></rss>