Lichen

Changeset

895:e1eba49a0d7c
2019-02-04 Paul Boddie raw files shortlog changelog graph Merged changes from trailing-data. float-preallocation
     1.1 --- a/templates/progops.c	Sat Feb 02 17:55:21 2019 +0100
     1.2 +++ b/templates/progops.c	Mon Feb 04 18:33:56 2019 +0100
     1.3 @@ -314,9 +314,17 @@
     1.4  
     1.5  int __BOOL(__attr attr)
     1.6  {
     1.7 -    /* Invoke the bool function with the object and test against True. */
     1.8 +    __ref value;
     1.9 +
    1.10 +    /* Integers can be used directly as truth values. */
    1.11  
    1.12 -    __ref value = __VALUE(attr);
    1.13 +    if (__INTEGER(attr))
    1.14 +        return __TOINT(attr);
    1.15 +
    1.16 +    /* Test against True and False explicitly. If necessary, invoke the bool
    1.17 +       function with the object and test against True. */
    1.18 +
    1.19 +    value = attr.value;
    1.20  
    1.21      return value == (__ref) &__predefined___builtins___boolean_True ? 1 :
    1.22             value == (__ref) &__predefined___builtins___boolean_False ? 0 :