POV-Ray : Newsgroups : povray.programming : objects.h - Copy_Flag Server Time
28 Jul 2024 10:30:35 EDT (-0400)
  objects.h - Copy_Flag (Message 1 to 2 of 2)  
From: Massimo Valentini
Subject: objects.h - Copy_Flag
Date: 13 Sep 2002 07:26:47
Message: <3d81cb77@news.povray.org>
Again, looking in the code I spotted this MACRO that seems to me
wrong:

-> File: objects.h Line: 55-56
 *   Copy_Flag   (Object1, Object2, Flag) : Set the Flag in Object1 to the
 *                                          value of the Flag in Object2.

-> File: objects.h Line: 108-111
#define Copy_Flag(Object1, Object2, Flag) \
  { (Object1)->Flags = (((Object1)->Flags) & (!Flag)) | \
                       (((Object2)->Flags) &  (Flag)); }




I think ~ is correct instead of !

#define Copy_Flag(Object1, Object2, Flag) \
  { (Object1)->Flags = (((Object1)->Flags) & (~Flag)) | \
                       (((Object2)->Flags) &  (Flag)); }

HTH Massimo


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: objects.h - Copy_Flag
Date: 16 Sep 2002 07:51:40
Message: <3d85c5cc@news.povray.org>
In article <3d81cb77@news.povray.org> , "Massimo Valentini" 
<six### [at] inwindit> wrote:

> Again, looking in the code I spotted this MACRO that seems to me
> wrong:
>
> -> File: objects.h Line: 55-56
>  *   Copy_Flag   (Object1, Object2, Flag) : Set the Flag in Object1 to the
>  *                                          value of the Flag in Object2.
>
> -> File: objects.h Line: 108-111
> #define Copy_Flag(Object1, Object2, Flag) \
>   { (Object1)->Flags = (((Object1)->Flags) & (!Flag)) | \
>                        (((Object2)->Flags) &  (Flag)); }
>
> I think ~ is correct instead of !

I agree.  However, s it is only used in Copy_Poly (the function that copies
declared poly objects), I guess nobody noticed yet in years...

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

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