Commit graph

113 commits

Author SHA1 Message Date
Kp 7fdce88558 Add parentheses around target of simple casts
C casts do not require parentheses.  C++ casts require grouping around
the target.  Prepare for conversion to C++ casts by adding otherwise
unnecessary parentheses around the target of simple C casts.

This pass does not attempt to process expressions that involve
any subexpression that can nest arbitrarily, such as parentheses or
brackets.  It also works only on commonly used standard types.

	(int) a->b;	// changed
	(int) a[b];	// not changed

s/\((\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\s*\**\s*)\s*\)\([&+-]\?\)\([[:alnum:]_.]\+\s*->\s*\)*\([[:alnum:]_.]\+\)\(\s*\([];+>)*\/^%,|&<>]\)\|$\|\(\s*-\s*[^>]\)\)/\1(\5\6\7)\8/g
2016-06-05 01:04:25 +00:00
Kp 568f165c28 Shrink sincos_table
For all valid i, sincos_table[i] == sincos_table[i % 256].  Remove
elements [256:] and modify callers to truncate the index.
2016-01-09 16:38:11 +00:00
Kp dc8c0323d8 Uninline namespace dcx 2015-12-13 18:00:49 +00:00
Kp cfc35e819d Use inline namespace dcx for common/maths 2015-12-05 22:57:24 +00:00
Kp 4f871c43fe Add compile-time check for non-overlapping vm_matrix_x_matrix 2015-08-13 03:15:52 +00:00
Kp c9dff229f1 Remove dead AI fire leading code 2015-07-25 23:10:47 +00:00
Kp a918692a23 Preprocess out EDITOR-only vm_vec_ang_2_matrix
Remove vm_vec_ang_2_matrix from non-EDITOR builds so that
sincos_2_matrix has only one caller, allowing compiler to implicitly
inline it.
2015-06-02 03:03:32 +00:00
Kp 0f6a82963a Inline fix_sincos in vm_extract_angles_matrix 2015-06-02 03:03:32 +00:00
Kp b207aa6900 Shorten vm_angles_2_matrix 2015-06-02 03:03:31 +00:00
Bradley Bell bdacd2f7d7 change u_int*_t to C99 standard uint*_t 2015-05-18 17:12:53 -07:00
Kp 9f01dcf0db Use signed multiplier in fix_sincos
Fixes: a5b83d19de ("Simplify fix_sin/fix_cos calls")
2015-04-30 03:32:27 +00:00
Kp a5b83d19de Simplify fix_sin/fix_cos calls 2015-04-29 03:35:09 +00:00
Kp 5e4bd5c73f vm_vec_delta_ang: check for vm_vec_copy_normalize failure
derhass reports that Raspbian g++-4.8.2 rejects vecmat.cpp for
-Wmaybe-uninitialized on t0, t1.  Fix it by adding code to return 0 if
vm_vec_copy_normalize leaves the temporary uninitialized.

Reported-by: derhass <https://github.com/dxx-rebirth/dxx-rebirth/issues/55>
2015-04-03 02:46:25 +00:00
Kp 90fbebf8fd Convert most global arrays to array<> 2015-04-02 02:36:52 +00:00
Kp 2c09f9fa90 Propagate special types for distance/magnitude 2015-03-12 02:21:19 +00:00
Kp f7d0c853ba Use special types for distance/magnitude 2015-03-12 02:21:19 +00:00
Kp ddfa4aeecf Inline away fixmulaccum in vm_vec_mag2 2015-02-05 03:03:51 +00:00
Kp 536c9af35d Pass sincos_2_matrix arg by & 2015-02-05 03:03:51 +00:00
Kp 673a711461 Remove vm_angles_2_matrix return value 2015-02-05 03:03:51 +00:00
Kp 1c58627aa3 Remove unused cos from fix_fastsincos 2015-02-05 03:03:50 +00:00
Kp 4c8f3a47b5 Convert frequently used casts to C++ casts 2015-02-05 03:03:49 +00:00
Kp 0b18b4140e Switch vm_vec_scale2 back to ALU
fixmuldiv uses higher precision now
2015-02-05 03:03:48 +00:00
Kp a8784bc486 Fold fixmul calls to fixmul64 2015-02-05 03:03:48 +00:00
Kp 949b019d55 Delegate vm_vec_scale to vm_vec_copy_scale 2015-02-03 00:37:08 +00:00
Kp d1f5695562 Remove unused return value of vm_vec_scale_add 2015-02-03 00:37:08 +00:00
Kp 2026ab7e3a Remove unused return value of vm_extract_angles_vector 2015-02-03 00:37:08 +00:00
Kp 656c51fa99 Remove unused return value of vm_vec_rotate 2015-02-03 00:37:08 +00:00
Kp 505a3dbae7 Remove unused return value of vm_vector_2_matrix 2015-02-03 00:37:07 +00:00
Kp c6f95c5880 Remove unused return value of vm_vec_normal 2015-02-03 00:37:07 +00:00
Kp 52267b87b9 Remove unused return value of vm_vec_cross 2015-02-03 00:37:07 +00:00
Kp aa75eb212c Remove unused return value of vm_vec_perp 2015-02-03 00:37:07 +00:00
Kp 055f9593de Remove unused return value of vm_vec_scale2 2015-02-03 00:37:07 +00:00
Kp cca8fd65a1 Remove unused return value of vm_vec_scale_add2 2015-02-03 00:37:07 +00:00
Kp e0bf0be779 Remove unused return value of vm_vec_add2 2015-02-03 00:37:07 +00:00
Kp e14440b0e0 Remove unused return value of vm_vec_sub2 2015-02-03 00:37:07 +00:00
Kp cd7e99981b Remove unused return value of vm_vec_avg 2015-02-03 00:37:07 +00:00
Kp cf4a36aeff Optimize quad_sqrt masking 2015-02-01 23:07:18 +00:00
Kp e0529b06a7 Improve fixmul* readability 2015-01-29 04:27:37 +00:00
Kp 5775881de6 Refactor vm_vec_dot 2015-01-17 04:31:17 +00:00
Kp ff493fcfce Inline vm_vec_make 2015-01-12 00:26:02 +00:00
Kp fda3fc33f3 Skip unnecessary sqrt for omega cannon 2014-11-11 04:25:47 +00:00
Kp d76e259db5 Add vm_vec_cross that returns result 2014-11-02 03:44:12 +00:00
Kp dac7f5e13b Pass get_angs_to_object arg by & 2014-11-02 03:42:02 +00:00
Kp 5952288b5d Pass vm_extract_angles_vector_normalized vector by & 2014-11-01 14:55:54 +00:00
Kp 5bb9c88979 Add vm_vec_sub that returns result 2014-10-29 03:24:31 +00:00
Kp 22ff219877 Factor out dividing vms_vector elements by a fix 2014-10-29 03:10:30 +00:00
Kp c7b2735e74 Mark vm_vector_2_matrix vectors const 2014-10-26 21:37:13 +00:00
Kp c928c09884 Skip sqrt for homing check 2014-10-10 02:41:51 +00:00
Kp fc7986092e Pass vm_vec_dot3 arg by & 2014-10-02 03:02:36 +00:00
Kp 6b93309ae5 Pass vm_vec_make arg by & 2014-10-02 03:02:35 +00:00