ObjFW  Diff

Differences From Artifact [a9d8cfa7c2]:

To Artifact [25b9edab19]:

  • File src/OFNumber.h — part of check-in [366681bebe] at 2014-06-26 00:58:57 on branch trunk — OFNumber: Remove methods for arithmetic

    These methods encouraged doing arithmetic on objects rather than getting
    the C type value, doing the arithmetic and creating a new object. They
    didn't do anything else internally, and so doing this manually isn't
    slower - it's even faster if you do multiple operations, as no temporary
    objects are created then.

    Another advantage of this is that there are no longer uncertainties
    about types of different OFNumber objects when doing arithmetic, as the
    user has to be explicit about the types when getting the C type value
    and thus knows which types will be used for the arithmetic. (user: js, size: 20849) [annotate] [blame] [check-ins using]


808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929

/*!
 * @brief Returns the OFNumber as a double.
 *
 * @return The OFNumber as a double
 */
- (double)doubleValue;

/*!
 * @brief Creates a new OFNumber by adding the specified number.
 *
 * @param num The OFNumber to add
 * @return A new autoreleased OFNumber added with the specified OFNumber
 */
- (OFNumber*)numberByAddingNumber: (OFNumber*)num;

/*!
 * @brief Creates a new OFNumber by subtracting the specified number.
 *
 * @param num The OFNumber to substract
 * @return A new autoreleased OFNumber subtracted by the specified OFNumber
 */
- (OFNumber*)numberBySubtractingNumber: (OFNumber*)num;

/*!
 * @brief Creates a new OFNumber by multiplying with the specified number.
 *
 * @param num The OFNumber to multiply with
 * @return A new autoreleased OFNumber multiplied with the specified OFNumber
 */
- (OFNumber*)numberByMultiplyingWithNumber: (OFNumber*)num;

/*!
 * @brief Creates a new OFNumber by dividing with with the specified number.
 *
 * @param num The OFNumber to divide by
 * @return A new autoreleased OFNumber devided by the specified OFNumber
 */
- (OFNumber*)numberByDividingWithNumber: (OFNumber*)num;

/*!
 * @brief Creates a new OFNumber by ANDing with the specified number.
 *
 * Does not work with floating point types!
 *
 * @param num The number to AND with.
 * @return A new autoreleased OFNumber ANDed with the specified OFNumber
 */
- (OFNumber*)numberByANDingWithNumber: (OFNumber*)num;

/*!
 * @brief Creates a new OFNumber by ORing with the specified number.
 *
 * Does not work with floating point types!
 *
 * @param num The number to OR with.
 * @return A new autoreleased OFNumber ORed with the specified OFNumber
 */
- (OFNumber*)numberByORingWithNumber: (OFNumber*)num;

/*!
 * @brief Creates a new OFNumber by XORing with the specified number.
 *
 * Does not work with floating point types!
 *
 * @param num The number to XOR with.
 * @return A new autoreleased OFNumber XORed with the specified OFNumber
 */
- (OFNumber*)numberByXORingWithNumber: (OFNumber*)num;

/*!
 * @brief Creates a new OFNumber by shifting to the left by the specified number
 *	  of bits.
 *
 * Does not work with floating point types!
 *
 * @param num The number of bits to shift to the left
 * @return A new autoreleased OFNumber bitshifted to the left with the
 *	   specified OFNumber
 */
- (OFNumber*)numberByShiftingLeftWithNumber: (OFNumber*)num;

/*!
 * @brief Creates a new OFNumber by shifting to the right by the specified
 *	  number of bits.
 *
 * Does not work with floating point types!
 *
 * @param num The number of bits to shift to the right
 * @return A new autoreleased OFNumber bitshifted to the right with the
 *	   specified OFNumber
 */
- (OFNumber*)numberByShiftingRightWithNumber: (OFNumber*)num;

/*!
 * @brief Creates a new OFNumber by with the same value increased by one.
 *
 * @return A new autoreleased OFNumber with the value increased by one.
 */
- (OFNumber*)numberByIncreasing;

/*!
 * @brief Creates a new OFNumber by with the same value decreased by one.
 *
 * @return A new autoreleased OFNumber with the value decreased by one.
 */
- (OFNumber*)numberByDecreasing;

/*!
 * @brief Creates a new OFNumber with the remainder of a division with the
 *	  specified number.
 *
 * @param num The number to divide by
 * @return The remainder of a division by the specified number
 */
- (OFNumber*)remainderOfDivisionWithNumber: (OFNumber*)num;
@end

#ifndef NSINTEGER_DEFINED
/* Required for number literals to work */
@compatibility_alias NSNumber OFNumber;
#endif







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






808
809
810
811
812
813
814













































































































815
816
817
818
819
820

/*!
 * @brief Returns the OFNumber as a double.
 *
 * @return The OFNumber as a double
 */
- (double)doubleValue;













































































































@end

#ifndef NSINTEGER_DEFINED
/* Required for number literals to work */
@compatibility_alias NSNumber OFNumber;
#endif