octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: surface cdata property restricted to double or uint8


From: John W. Eaton
Subject: Re: surface cdata property restricted to double or uint8
Date: Mon, 30 Aug 2010 11:12:14 -0400

On 30-Aug-2010, Jaroslav Hajek wrote:

| On Mon, Aug 30, 2010 at 12:41 PM, Michael Goffioul
| <address@hidden> wrote:
| > On Mon, Aug 30, 2010 at 11:14 AM, Jaroslav Hajek <address@hidden> wrote:
| >> I considered John's latest changeset to be the current situation. I
| >> thought that previously uint8 data wasn't allowed at all. At least
| >> that's the impression I got.
| >
| > Just for the record. It was supported, as double data was supported as
| > well. Other data types weren't supported.
| >
| 
| Aha, now I see. My apologies. Maybe the original solution was the best
| compromise after all... Though it still was buggy; see the comment
| about data() called on temporary expressions. That is a bad idea; you
| should (almost) never do it. So let's now start from this more correct
| one and talk about a 25% memory improvement :)

OK, I checked in the template-based approach instead and used a
temporary, like this:

  #define CONVERT_CDATA_1(ARRAY_T, VAL_FN) \
    do \
      { \
        ARRAY_T tmp = cdata. VAL_FN ## array_value (); \
   \
        convert_cdata_1 (is_scaled, clim_0, clim_1, cmapv, \
                         tmp.data (), lda, nc, av); \
      } \
    while (0)

    if (cdata.is_uint8_type ())
      CONVERT_CDATA_1 (uint8NDArray, uint8_);
    ...

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]