POV-Ray : Newsgroups : povray.advanced-users : write uint32_t Server Time
28 Mar 2024 12:55:19 EDT (-0400)
  write uint32_t (Message 1 to 10 of 15)  
Goto Latest 10 Messages Next 5 Messages >>>
From: ingo
Subject: write uint32_t
Date: 29 Mar 2021 09:35:59
Message: <XnsACFC9EABB33B7seed7@news.povray.org>
The fine documentation states: "Note: Currently, unsigned 32-bit words are 
not supported."

Guess what. I need those.

Is there some trickery with 4 uint8' or 2 uint16le's to get the proper 
bytes in the proper place?


TIA,

Ingo


Post a reply to this message

From: William F Pokorny
Subject: Re: write uint32_t
Date: 29 Mar 2021 12:34:02
Message: <6062017a$1@news.povray.org>
On 3/29/21 9:35 AM, ingo wrote:
> The fine documentation states: "Note: Currently, unsigned 32-bit words are
> not supported."
> 
> Guess what. I need those.
> 
> Is there some trickery with 4 uint8' or 2 uint16le's to get the proper
> bytes in the proper place?
> 

For what feature/functionality ?

When writing files I'm not aware of any 32bit write / per channel 
capability today in any official version of POV-Ray. If storing values 
doubles give you effectively more than 32bits of depth - at the cost of 
doubles.

Bill P.


Post a reply to this message

From: ingo
Subject: Re: write uint32_t
Date: 29 Mar 2021 12:57:55
Message: <XnsACFCC0E88F585seed7@news.povray.org>
in news:6062017a$1@news.povray.org William F Pokorny wrote:

> For what feature/functionality ?
> 
> 

Sorry Bill. I wasn't very clear. For "3.3.2.3.4 The write Directive". It 
supports: 
sint32be, sint32le - signed 32-bit word (-2^31..2^31-1)
but not uint32.

Ingo


Post a reply to this message

From: Thorsten
Subject: Re: write uint32_t
Date: 29 Mar 2021 13:13:02
Message: <60620a9e$1@news.povray.org>
On 29.03.2021 18:57, ingo wrote:
 > Sorry Bill. I wasn't very clear. For "3.3.2.3.4 The write Directive". It
 > supports:
 > sint32be, sint32le - signed 32-bit word (-2^31..2^31-1)
 > but not uint32.

You can just compute the ones' complement inverse before output, and you 
get what you want ;-)

Thorsten


Post a reply to this message

From: Thorsten
Subject: Re: write uint32_t
Date: 29 Mar 2021 13:15:34
Message: <60620b36$1@news.povray.org>
On 29.03.2021 18:57, ingo wrote:
> Sorry Bill. I wasn't very clear. For "3.3.2.3.4 The write Directive". It
> supports:
> sint32be, sint32le - signed 32-bit word (-2^31..2^31-1)
> but not uint32.

You can just compute the two's complement inverse before output, and you 
get what you want

Thorsten


Post a reply to this message

From: ingo
Subject: Re: write uint32_t
Date: 29 Mar 2021 13:25:35
Message: <XnsACFCC59E163CDseed7@news.povray.org>
in news:60620b36$1@news.povray.org Thorsten wrote:

> You can just compute the two's complement inverse before output, and
> you get what you want
> 

Sorry Thorsten, I realy don't understand. Can we do it by example.
I have a number, 4321 and it hast to written to a file as uint_32.


Ingo


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: write uint32_t
Date: 29 Mar 2021 13:35:00
Message: <web.60620e7f8cf934b8ae6f04a89db30a9@news.povray.org>
ingo <ing### [at] tagpovrayorg> wrote:
> The fine documentation states: "Note: Currently, unsigned 32-bit words are
> not supported."
>
> Guess what. I need those.
>
> Is there some trickery with 4 uint8' or 2 uint16le's to get the proper
> bytes in the proper place?

Hi Ingo

You can try this:

#version 3.7;

#declare AnInteger = 4091728320; // 0xf3e2d1c0

#declare R = AnInteger;
#declare Byte_0 = mod(R, 256);
#declare R = div(R, 256);
#declare Byte_1 = mod(R, 256);
#declare R = div(R, 256);
#declare Byte_2 = mod(R, 256);
#declare R = div(R, 256);
#declare Byte_3 = mod(R, 256);

#fopen SomeFile "LitteEndian.bin" write
#write (SomeFile, uint8 Byte_0)
#write (SomeFile, uint8 Byte_1)
#write (SomeFile, uint8 Byte_2)
#write (SomeFile, uint8 Byte_3)
#fclose SomeFile

#fopen SomeFile "BigEndian.bin" write
#write (SomeFile, uint8 Byte_3)
#write (SomeFile, uint8 Byte_2)
#write (SomeFile, uint8 Byte_1)
#write (SomeFile, uint8 Byte_0)
#fclose SomeFile

#error "Finished"

You can upload the resulting files to this web page: https://hexed.it
- and then inspect the results as both big endian and little endian integeres.

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

From: Bald Eagle
Subject: Re: write uint32_t
Date: 29 Mar 2021 13:45:00
Message: <web.606211058cf934b81f9dae3025979125@news.povray.org>
If you get any of that to work, I would like a very small working code snippet
to paste into my collection of Keyword Examples.

Computing complement inverses would be a nice trick to add in as well.

I'm sticking to the stuff I know how to do already, and saving the "need to
learn that" stuff until later/last.


Post a reply to this message

From: ingo
Subject: Re: write uint32_t
Date: 29 Mar 2021 13:45:38
Message: <XnsACFCC9042258Fseed7@news.povray.org>
in news:web.60620e7f8cf934b8ae6f04a89db30a9@news.povray.org Tor Olav
Kristensen wrote: 

> 
> #declare AnInteger = 4091728320; // 0xf3e2d1c0
> 
> #declare R = AnInteger;
> #declare Byte_0 = mod(R, 256);
> #declare R = div(R, 256);
> 
> [.....]
> 

Thank you Tor Olav!

Ingo


Post a reply to this message

From: Bald Eagle
Subject: Re: write uint32_t
Date: 29 Mar 2021 14:00:00
Message: <web.606214ce8cf934b81f9dae3025979125@news.povray.org>
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:

> You can try this:

Leave it to you to post a full code example before I even finished typing my
request  :D  (He's too fast for me, folks.)


That ought to give me some more interesting material for div and mod as well.
:)

Thanks for keeping the info flowing - there's always something new to learn.


Post a reply to this message

Goto Latest 10 Messages Next 5 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.